This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes The ejbPostCreate Method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "The ejbPostCreate Method " Watch "The ejbPostCreate Method " New topic

The ejbPostCreate Method

Maria George

Joined: Dec 25, 2006
Posts: 3
I am going through the sun J2EE tutorials...I have some doubts on entity bean example:
It says: For each ejbCreate method, you must write an ejbPostCreate method in the entity bean class. The EJB container invokes ejbPostCreate immediately after it calls ejbCreate.
My question is can we allow a client to invoke this method (indirectly ofcourse) by defining postCreate method in the home interface..
[ December 25, 2006: Message edited by: Maria George ]
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4968

Deepak Bala

Joined: Feb 24, 2006
Posts: 6662

No that is not allowed. You have a postCreate() to tell the bean that an EJBObject is now available for use. You create the primary key in ejbCreate() and by the time its postCreate() the bean has full beaness and can even enter into a transaction.

SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
subject: The ejbPostCreate Method
It's not a secret anymore!