-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Insert fails for complex relationship
PostPosted: Thu Jan 13, 2005 7:09 pm 
Newbie

Joined: Thu Jan 13, 2005 6:36 pm
Posts: 1
Hibernate version:
2.1.2

Mapping documents:

Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:

Name and version of the database you are using:
Oracle 9.2.0

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:




I am working with a complex data model that Hibernate seems to be struggling with. If anyone has done something similar, or knows the answer to the following scenario, I would appreciate your help.

The following is an example of what we are trying to do:


Code:

       Product - 1 -----------------------0..*---< Product Language
           1                                              1
             |                                             |
             |                                             |
             |                                             |
           0..*                                         0..*
             |                                             |
             /\                                            /\
       Product Feature --1------------- 0..* --< Product Feature Description       



Note: We are using Oracle to enforce foreign key constraints between the tables.

Deleting from the collections does not seem to be an issue. However, inserts do not happen in the right order. Adding a new Product Feature with a new Product Feature Description will try to add the Product Feature Description as a child of the Product Language first, and then add the Product Feature. This will cause an exception to be thrown indicating that a parent child relationship has been violated. Does anyone know of a way to deal with this in Hibernate?

Cascade for the collections is set to all-delete-orphans, and inverse is set to true on the collections in both ProductLanguage and ProductFeature which contain ProductFeatureDescriptions.

Thanks for the help,
Shawn Vincent


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.