aspose file tools*
The moose likes Object Relational Mapping and the fly likes Hibernate one-to-many relationship insert Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate one-to-many relationship insert" Watch "Hibernate one-to-many relationship insert" New topic
Author

Hibernate one-to-many relationship insert

Nischal Tanna
Ranch Hand

Joined: Aug 19, 2003
Posts: 182
I am having a 1-to-many relationship btw Parent and child class....In the parent class i am something like


While inserting records in the db, my code is:



The above code inserts successfully in the parent db but does not insert in the child table

Any ideas?....I have tried "inverse=true" as well...Do i need to define a Many-to-one in child as well?
[ July 16, 2007: Message edited by: Nischal Tanna ]

Thnx
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17257
    
    6

What are your cascade options set to for this relationship? you will probably want it set to "save-update".

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Hibernate one-to-many relationship insert