-->
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: Foreign Key relationship problem in Hibernate
PostPosted: Thu Oct 11, 2007 1:37 pm 
Newbie

Joined: Thu Oct 11, 2007 1:34 pm
Posts: 2
Hello,

I have a very unique problem in Hibernate. I will try to explain the problem as clearly as possible.

I have a table A which has three columns 1, 2 and 3. These 3 columns are nullable columns.

I have a table B which has fields 4 and 5 as its compound key. Now, the table A has a foreign key relationship with table B through fields 1 and 4 and also 2 and 5.

I have another table C which has fields 6 and 7 as its compound key. The table A has a foreign key relationship with table C through fields 3 and 6 and also 2 and 7.

Now, my problem is since the field 2 in table A is related to both Table B and table C, Hibernate is not allowing me to use insert=true and update=true for the relationships of table A and B and table A and C. If I do so, then at startup, hibernate throws me an error to set either one of the relationships as false. If I set either one of the relationships as false, then I am not able to update the database with the required value since I am explicitly setting the insert and update as false.

I need to update fields 1, 2 and 3, but the relationships is not allowing me to do so. Please let me know what can be done for the above issue.

I tried using native SQL to update the tables. But I got an exception saying that only HQL should be used for insert/update.

Please let me know if there is any other way.


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.