jQuery in Action, 3rd edition
The moose likes Object Relational Mapping and the fly likes hiberante - one-to -many Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "hiberante - one-to -many" Watch "hiberante - one-to -many" New topic

hiberante - one-to -many

gr Chinna

Joined: Jul 17, 2005
Posts: 2
hai,i am using Hibernate3.0 one to many mapping...the problem is when i am using one to many,i am trying to map from parent to child..but this child has a foreign key which refers to parentID of parent table which is sequence generator..now if i want save the parent records,my parent id has to go to map the child,which is one -many here..how it is possible here..bocz of my parent will create . then only that id goes to child know...is it possible?or any other way........?
Jaikiran Pai

Joined: Jul 20, 2005
Posts: 10441

This is a typical case, of having parent/child relationship in Hibernate.
Hibernate takes care of ordering the sequence of sqls, so you need not worry about the FK violations. You just have to provide the appropriate <set> mapping in the hbm files

[My Blog] [JavaRanch Journal]
I agree. Here's the link: http://aspose.com/file-tools
subject: hiberante - one-to -many
It's not a secret anymore!