• 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:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

HF-EJB cmr confusion

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
Looking at the entity bean relationships chapter in the head first ejb book I have a question concerning the MovieBean/Director example.
In the MovieBean instead of mapping the directorId db field to an abstract getter/setter it has used a cmr field for director so you can link to the Director bean instead of just the db foreign key id. This is great, but I'm just wondering when you create a new MovieBean (and a new row in the db), the ejbPostCreate method is called (where you call the setDirector with the corresponding Director entity) how the db will know to insert the directorId from the DirectorBean into the newly created Movie db row (giving it the correct fk).
Hope this is clear, not overly sure if its clear in my head to be honest!!
Thanks
Chris
 
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The Director entity bean will know what its primary key is. The container can simply call the getPrimaryKey method on the Director entity to set the movie table's fk.
 
crispy bacon. crispy tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic