Forums Register Login

ejbPostCreate

+Pie Number of slices to send: Send
What is the typical implemetation of the ejbPostCreate method in an entity bean?
+Pie Number of slices to send: Send
I used to go crazy to understand this concept. But some how I got it. Thanx to one of my friend.This ejbPostCreate is used in a very rare situation. Before telling the situation, let me explain the difference between (or relationship) between ejbCreate and ejbPostCreate in Entity Bean. ejbPostCreate() is called by the EJB Container after the ejbCreate().The only difference is ejbPostCreate method will have the reference to the ejbObject and ejbCreate() will not have reference to ejbObject. So when you have a child parent relationship between two beans , and when you are loading the parent Bean you want to load or intialize the child bean. Then when you want to load the child bean you need to pass the instance of the Parent Bean.So you could not intialize the child bean in the ejbCreate of the parent bean as you will not have the reference to the ejbObject ( remember the bean reference passed is always ejbObject not "this" i.e.., the bean itself) . That is why we need a extra method in case of Entity bean to intialize the Child Bean
I hope I have explained , but let me know if I am not clear. This is a very easy concept, but a hard one to explain
+Pie Number of slices to send: Send
Hey shiva kumar,
Thanks for that detailed reply.I knew that postcreate is called after the bean in associated with the entity instance in the underlying database.What i did not know is where i need to use it.Your parent child case is a good situation thanks
+Pie Number of slices to send: Send
You are welcome Kane
We don't have time to be charming! Quick, read this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1124 times.
Similar Threads
EJB:: ejbPostCreate()
is ejbPostCreate() method is only for entitiy beans?
ejbPostCreate
What is the exact use of ejbPostCreate()
About ejbPostCreate
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 22:33:15.