• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doubts in ejbCreate and ejbPostCreate

 
Micheal John
Ranch Hand
Posts: 344
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to know what is the exact differneces between ejbCreate() and ejbPostcreate().

I want to know what will exactly happened when the container calls ejbCreate() on the bean(though I know ejbCreate() will behave differently for session & entity bean).

Why to call ejbPostcreate() on the bean..?and what is the purpose..?

any input on it..will be useful for my understanding and to move further..
 
Purushoth Thambu
Ranch Hand
Posts: 425
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you have just one Entity then you don't need the postcreate method, but this is not the case as we have more than one entity which are related to one another. PostCreate method is used to manage this relationship. Either it be create/activate you need this method to initialize/load the object in the other end of the relationship. If you look at the EJB spec you will definitely find more explanation and example.
 
Rodrigo Dinis
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ninety percent of your question was answered, but a piece not. You ask what is the diference between ejbCreate() method in a Session (stateless) and Entity beans. The answer is: Session stateless this method is called by the container when the container starts (it create a bunch of them) and after created its beans are putted on the pool. At the Entity the ejbCreate() is executed when the client call create on the home interface, it will get a bean from the pool and create an entity (row) on underline database. So it is much different.

Best regards,
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why to call ejbPostcreate() on the bean..?and what is the purpose..?

Aren't you using a book to prepare for this exam ?
 
Micheal John
Ranch Hand
Posts: 344
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Everybody uses either book/specification for the exam and why we are posting in the forum is we are not able to understand certain things in the book.

So according to you in this forum the user are posting question, who are not having any source of book..
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So according to you in this forum the user are posting question, who are not having any source of book..

Micheal, forget about my comment
I thought that if you were using a book like HFEJB, you wouldn't need to ask this kind of question. But you're right, you're free to ask anyway. I apology.
 
Micheal John
Ranch Hand
Posts: 344
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No Problem. I have take it positively only. No need of apologies
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic