This week's book giveaway is in the Performance forum.
We're giving away four copies of The Java Performance Companion and have Charlie Hunt, Monica Beckwith, Poonam Parhar, & Bengt Rutisson on-line!
See this thread for details.
Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

with Hibernate in one to many

 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Theoritically my understanding with Hibernate in one to many has been fine .

But when i tried to put it on pratical i found it some what strange .

I faced the condition here a standard example : Author and Books (where a Author can have Many Books)






// Here is the Confusion part for me

// The client class

 
Rahul Babbar
Ranch Hand
Posts: 210
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
that depends on your id generation strategy defined in your hbm files.
If can take various values depending on your requirements and the database.
Some of the strategy names include "assigned", "increment", "sequence" etc.
 
Javid Jamae
Author
Ranch Hand
Posts: 198
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To elaborate on Rahul's answer, most of the id generation strategies don't require you to set the id in code, they know how to generate an ID based on your database.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic