Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Doubts in ejbCreate and ejbPostCreate

 
Ranch Hand
Posts: 344
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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..
 
Ranch Hand
Posts: 425
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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,
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No Problem. I have take it positively only. No need of apologies
 
I've been selected to go to the moon! All thanks to this tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic