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
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..
Micheal John
SCJP 1.4 (86%), SCWCD 1.4 (86%), SCBCD 1.3 (85%), SCDJWS (Just Started...) - Satisfaction Lies in Our EFFORT, Not in the ATTAINMENT
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.
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.
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.