void remove(
Object entity
)
Mark a managed entity instance as removed, resulting in its deletion from the database when the persistence context is synchronized with the database. This operation cascades to every entity related by an association marked cascade=REMOVE. If the given entity instance is already removed, it is ignored. If the given entity is new, it is itself ignored, but the operation still cascades.
- Parameters:
entity- a managed, new, or removed entity instance
- Throws:
- IllegalArgumentException - if the instance is not an entity or is a detached entity
- TransactionRequiredException - if invoked on a container-managed entity manager of type {@link PersistenceContextType#TRANSACTION} and there is no transaction
- Since:
- JPA 1.0