Annotation Interface OriginalStates


@Target(FIELD) @Retention(RUNTIME) public @interface OriginalStates
Indicates that the annotated field holds original states of an entity that were fetched from the database.

This annotation enables partial updates where only modified properties are included in SQL UPDATE statements.

The annotated field must be a member of an Entity annotated class. The field type must be the same as the Entity annotated class.

The field must not be modified by application code.

 @Entity
 public class Employee {

     String name;

     @OriginalStates
     Employee originalStates;

     public String getName() {
         return name;
     }

     public void setName(String name) {
         this.name = name;
     }

     ...
 }
 
See Also: