File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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 if i want save the parent records,my parent id has to go to map the child,which is one -many it is possible here..bocz of my parent will create . then only that id goes to child 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:
subject: hiberante - one-to -many
jQuery in Action, 3rd edition