File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB and other Java EE Technologies and the fly likes create method in the home Interface Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "create method in the home Interface" Watch "create method in the home Interface" New topic

create method in the home Interface

Maneesh Chauahn
Ranch Hand

Joined: Mar 06, 2006
Posts: 48
Hi All,
I have a query regarding the implementation of the home interface in the EJB. For every createXxxx() method present in the home interface , developer need to define the ejbCreateXxxxx() and ejbPostCreateXxxx() method in the bean class. As the ejbCreateXxxx() method is called by the container prior to bean created and prepares the bean for creation.

Why there is need to define the ejbPostCreateXxxx method. As per me container can perform all the business logic that will need to create a bean should be done on ejbCreateXxxx method

So can anyone please tell me what is the use of the ejbPostCreateXxxx method
Mark Spritzler

Joined: Feb 05, 2001
Posts: 17276

Things to do right after the creation of the bean. Sometimes to initialize values in attributes within the bean. The Home object won't have reference to it unless you provide public methods, which isn't really a nice clean design.


Perfect World Programming, LLC - iOS Apps
How to Ask Questions the Smart Way FAQ
Deepak Bala

Joined: Feb 24, 2006
Posts: 6662

Plus you create a primary key in ejbCreate() and the bean gets full beaness only in ejbPostCreate() at which point an EJB object will be associated with that bean.

SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
I agree. Here's the link:
subject: create method in the home Interface
It's not a secret anymore!