-->
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.  [ 3 posts ] 
Author Message
 Post subject: Problem with Many to One & Unidirectional
PostPosted: Tue Aug 16, 2005 11:38 pm 
Newbie

Joined: Mon Jul 18, 2005 3:51 pm
Posts: 4
I have many-to-one uni-directional mapping between class A and class B. The relationship specified in the mapping file for class B as follows:

<many-to-one
name="A"
class="pakage.A"
column="A_ID"
/>


I able to delete class B using session.delete(object of B). But I could not use this method to delete the object of A when it's refered by object B. I am getting error message for foreign constraint violation.
Do I have to use queries to set the foreign key to null, before deleting? Or Are there parameter(attributes) exist to do this?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 17, 2005 3:30 am 
Expert
Expert

Joined: Sat Oct 25, 2003 8:49 am
Posts: 490
Location: Vrhnika, Slovenia
Make it bi-directional with correct 'inverse' attribute.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 17, 2005 9:31 am 
Newbie

Joined: Mon Jul 18, 2005 3:51 pm
Posts: 4
That's right, but I want to maintain the relationship, uni-directional. Since if the relationship is changed, I have to chage a lot in my code.


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

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.