posted 16 years ago
A MANAGED entity instance becomes REMOVED by invoking the remove method on it or by cascading the remove operation.
The semantics of the remove operation, applied to an entity X are as follows:
If X is a NEW entity, it is IGNORED by the remove operation. However, the remove operation is cascaded to entities referenced by X, if the relationship from X to these other entities is annotated with the cascade=REMOVE or cascade=ALL annotation element value.
What does this mean. If X is a new entity? When X is a new entity, there is no persistence identity assocated with it. So calling remove, would'nt it raise an exception.
If X is a MANAGED entity, the remove operation causes it to become REMOVED. The remove operation is cascaded to entities referenced by X, if the relationships from X to these other entities is annotated with the cascade=REMOVE or cascade=ALL annotation element value.
If X is a DETACHED entity, an IllegalArgumentException will be thrown by the remove operation (or the transaction commit will fail).
If X is a REMOVED entity, it is IGNORED by the remove operation.
If X is already removed, then again it should throw an exception
A removed entity X will be removed from the database at or before transaction commit or as a result of the flush operation.
Am I reading all these correctly?
SCJP 1.4, SCWCD 1.4, SCBCD 1.5, TOGAF 9, Comptia Cloud+