Auditing Sometime we need to keep track with the change of the Entity, eg. When it is created Who created it Last modified date Last modified by somebody Implement via JPA JPA specification provides a complete lifecycle of an Entity, which is easy to archive those purposes. An example(dummy codes). @Entity public class Conference{ private User createdBy; private Date createdDate; private user lastModifiedBy; private Date lastModifiedDate; @PrePersist public void prePersist(){ setCreatedBy(currentUser); setCreatedDate(new Date()); } @PreUpdate public void preUpdate(){ setLastModifiedBy(currentUser); setLastModifiedDate(new Date()); } } In this example, the method prePersist annotated with @PrePresist indicates it will be executed before em.persist (em is stand for jpa EntityManager) is executed. And @PreUpdate will be executed before em.merge is executed. JPA also provides a ...