• Post Reply Bookmark Topic Watch Topic
  • New Topic

container managed relationship?

 
pradeep arum
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I have 2 tables that represent 2 beans and and they are in 1:N relationship, i do not have to mention the relation field in the ejbCreate(),but how is the mapping done to the database ,can anybody please explain?
for more reference please go through this
I am stuck with this part of CMRelationship...
what I understand from page 396, HFEJB is-> in the ejbcreate()I have 5 fields of which 4 are inserted into the database and for the 5th one I wait till ejbPostCreate() and do a setDirector(dir)....by doing so what did the database get as the 5th field( ie how did the directorID get into the database ?)
HOW IS THE FOREIGN KEY PROCESSING DONE?
THROW SOME LIGHT ...PLEASE
thanks
Pradeep
 
Harsha Huddar
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have to mention the relationship in the ejb-jar.xml the configuration file for your EJB's
 
Sergiu Truta
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have to set all the fields inside ejbCreate(), except for the CMR field. This is the field defining the relationship and the field specified inside the deployment descriptor as the CMR field.
You have to create first the bean and only then set the relationship, that is why the CMR fields are set inside ejbPostCreate().
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!