This week's book giveaway is in the Big Data forum.
We're giving away four copies of Elasticsearch in Action and have Radu Gheorghe & Matthew Lee Hinman on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes EJB:: ejbPostCreate() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "EJB:: ejbPostCreate()" Watch "EJB:: ejbPostCreate()" New topic

EJB:: ejbPostCreate()

Raj Waters
Ranch Hand

Joined: Apr 21, 2002
Posts: 37
What is the purpose of this method? Any good example which justifies the use of ejbPostCreate()?

- Raj<br />[MCSE, SCJP, SCWCD]
Lasse Koskela

Joined: Jan 23, 2002
Posts: 11962
Unlike the ejbCreate() method, the ejbPostCreate() method can invoke the getPrimaryKey() and getEJBObject() methods of the EntityContext interface. This makes ejbPostCreate() the only place where you can perform initialization requiring the identity of the entity bean, such as bi-directional dependencies (CMR).

Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
subject: EJB:: ejbPostCreate()