9.4.3 remove operation for the entities
To execute the remove operation for the entities, invoke the remove method of EntityManager. If the remove method of EntityManager is invoked and the remove processing is cascaded, the state of the entity becomes removed. A removed entity is deleted from the database by the transaction commit processing.
The following table describes the state of the entity after the remove operation, for each entity state.
State of the entity |
Result of state transition |
---|---|
new |
The remove operation is ignored. However, if REMOVE or ALL is specified in the cascade attribute for the relationship from one entity to another entity, the remove operation is propagated to the entities referenced by this entity. |
managed |
The state changes to removed. If REMOVE or ALL is specified in the cascade attribute for the relationship from one entity to another entity, the remove operation is propagated to the entities referenced by this entity. |
detached |
The state changes as follows:
|
removed |
The remove operation is ignored. The operation is also not propagated to other entities. |