| EJB 2.x life-cycle method |
What to do in EJB 3.0 |
| ejbCreate() |
Implement logic in init methods/constructors. |
| ejbPostCreate() |
Implement logic in a constructor, or create a business method and annotate it as @PostPersist. |
| ejbRemove() |
Create a business method, and annotate it with @PreRemove. |
setEntityContext()
unSetEntityContext() |
No longer applies. |
| ejbActivate() |
Create a business method, and annotate it as @PostLoad |
| ejbPassivate() |
No longer applies (it can be removed). |
| ejbStore() |
Create a business method, and annotate it with either @PrePersist or @PreUpdate. |
Table 3 Migration Strategies
Because some of the life-cycle events in EJB 2.x no longer apply, here are some possible strategies for migrating existing implementations of these life-cycle methods.
|