@PostPersist

From CauchoWiki

Jump to: navigation, search


The @PostPersist annotation marks an entity's method as a callback after an entity has been created in the database.

 import javax.persistence.*;
 
   @Entity
   public class MyEntity {
       @Id getId() { ... }
 
       @PostPersist
       public void afterCreate()
       {
          ...
       }
       
       ...
   }

[edit] Definition

 @Target(METHOD)
 @Retention(RUNTIME)
 public @interface PostPersist {
 }
Personal tools