Hitachi

uCosminexus Application Server Compatibility Guide


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.

Table 9‒9: State of entity in the remove operation

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:

  • If the line corresponding to the detached entity passed in the argument exists in the database, IllegalArgumentException is thrown during the remove operation.

  • For Cosminexus JPA Provider, if the corresponding line does not exist in the database, the remove operation is ignored. However, if REMOVE or ALL is specified in the cascade attribute for the relationship with other entities, the remove operation is propagated to the entities referenced by this entity.

removed

The remove operation is ignored. The operation is also not propagated to other entities.

Note 1: A removed entity is deleted from the database as a result of the execution of operations during transaction commit, before transaction commit, or during flush operations.

Note 2: After the entity is deleted, the entity contents change to the contents immediately after the remove processing was invoked, however, excluding the content immediately after the entity was generated.