• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Bear Bibeault
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • salvin francis
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Frits Walraven
Bartenders:
  • Jj Roberts
  • Carey Brown
  • Scott Selikoff

ejbPostCreate

 
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is the typical implemetation of the ejbPostCreate method in an entity bean?
 
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
william kane
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Siva Jagadeesan
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are welcome Kane
 
I am displeased. You are no longer allowed to read this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic