This week's book giveaway is in the Cloud forum.
We're giving away four copies of Terraform in Action and have Scott Winkler on-line!
See this thread for details.
Win a copy of Terraform in Action this week in the Cloud forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

container managed relationship?

 
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 775
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You'll definitely drive yourself crazy if you are hoping this will be clear from the ejb-jar.xml descriptor content. The real mechanics are container-specific, and much clearer with some containers like JBoss.
As far as ejb-jar.xml and the bean callback methods are concerned, you can think of it like this:
0. before ejbCreate, the container doesn't know the pk
of the new entity.
1. ejbCreate() populates the data for the current entity,
including the fields necessary to define the pk, but
excluding any CMR foreign-key references.
2. After ejbCreate, but before ejbPostCreate, the container
knows the pk for your new entity.
3. ejbPostCreate() deals both with storing foreign keys
into your new entity, *and* providing your pk as a
foreign key value to other entities (remember, your
deployment descriptor might specify that the relationship
is navigable in both directions).
 
You showed up just in time for the waffles! And 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