Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

create method in the home Interface

 
Maneesh Chauahn
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Mark
 
Deepak Bala
Bartender
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic