Annotation Interface EntityId


@Target(FIELD) @Retention(RUNTIME) @Documented public @interface EntityId
The EntityId annotation can be placed on the entity field. It is only processed, if the entity has the SCD annotation, otherwise it will be ignored on the field. With this annotation, it can be specified which field will have the original primary id of the entity written to it, during the SCD persistation.

The annotation loading order:
In the case of a new entity:
When creating a new entity, the EntityId field will have the currently saved entity's primary key value written to it. In the case of modifying an existing entity:
When modifying an existing entity, the last record that was modified, will be queried first. The received record's primary ID will be written in the field (of the to be persisted record), that has the EntityId annotation.

Since:
4.0
Author:
JBStrap
See Also: