jQuery in Action, 3rd edition
The moose likes Object Relational Mapping and the fly likes with Hibernate in  one to many Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "with Hibernate in  one to many" Watch "with Hibernate in  one to many" New topic

with Hibernate in one to many

Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234

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

Save India From Corruption - Anna Hazare.
Rahul Babbar
Ranch Hand

Joined: Jun 28, 2008
Posts: 210
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.

Rahul Babbar
Javid Jamae
Ranch Hand

Joined: May 14, 2008
Posts: 198
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.

Author: JBoss in Action, javidjamae.com, @javidjamae on Twitter
I agree. Here's the link: http://aspose.com/file-tools
subject: with Hibernate in one to many
It's not a secret anymore!