@PostLoad

From CauchoWiki

Jump to: navigation, search


The @PostLoad annotation marks an entity's method as a callback after the entity is loaded from the database.

Applications can use @PostLoad to provide post-load processing.

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

[edit] Definition

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