@PrePersist
From CauchoWiki
The @PrePersist annotation marks an entity's method as a callback before a new entity is created in the database.
Applications can use @PreUpdate to process the persistent state of an entity before the entity is created.
import javax.persistence.*;
@Entity
public class MyEntity {
@Id getId() { ... }
@PrePersist
public void beforeCreate()
{
...
}
...
}
[edit] Definition
@Target(METHOD)
@Retention(RUNTIME)
public @interface PrePersist {
}
