Oracle® Containers for J2EE Enterprise JavaBeans Developer's Guide 10g (10.1.3.1.0) Part Number B28221-02 |
|
|
View PDF |
You can specify a JPA entity class method as a callback method for any of the following life cycle events:
Pre-persist
Post-persist
Pre-remove
Post-remove
Pre-update
Post-update
Post-load
The entity class method must have the following signature:
int <METHOD>()
The entity class method can have any method name as long as it does not begin with ejb
.
For more information, see the following:
"Descriptor Event Manager" in the Oracle TopLink Developer's Guide
"Configuring a Domain Object Method as an Event Handler" in the Oracle TopLink Developer's Guide
Note:
For an EJB 3.0 life cycle callback method code example, see:http://www.oracle.com/technology/tech/java/oc4j/ejb3/howtos-ejb3/howtoejb30mappingannotations/doc/how-to-ejb30-mapping-annotations.html#callbacks
.You can specify a JPA entity class method as a life cycle callback method using any of the following annotations:
Example 7-30 shows how to use the @PrePersist
annotation to specify JPA entity class method initialize
as a life cycle callback method.