-->
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.  [ 2 posts ] 
Author Message
 Post subject: Strange Problem with Parent Child relationships
PostPosted: Sat Mar 27, 2004 5:33 am 
Beginner
Beginner

Joined: Wed Mar 17, 2004 12:44 am
Posts: 25
Hello folks,

In a parent child relationship

Parent
====
Parent_Id

Child
===
Child_Id
Parent_Id
Another_Id

In the parent hbm I define a <set> of child objects and in child hbm I have a <many-to-one> relationship with parent and not-null = "true".

Now I get the set from the parent domain object that contains objects of the child class. I do some addition and deletion to the set that reflects the database due to cascade="all-delete-orphan".

Problem : While adding the Set that has unique objects to the database table hibernate should fire delete on some of the records that no longer exists in the set. But it is firing an insert first. And in this insert statement it is trying to insert Parent_Id as null. However I have already called setParent(parentObject) method that sets the parent object for me. The Parent_Id has a not null constraint and a Unique constraint jointly with Another_Id.

Can anyone throw some light on this ? M not sure how should I proceed further..



nitin


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 29, 2004 4:17 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Did you read that ?
http://www.hibernate.org/155.html

_________________
Emmanuel


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.