-->
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: Problem with composite id and deletion
PostPosted: Thu Jul 08, 2004 5:36 am 
Beginner
Beginner

Joined: Thu May 13, 2004 5:51 am
Posts: 28
I have a weird problem with a child entity with composite id , containing the parents primary key.
Mapping:
In Parent:
<id name="parentId" type="integer">
<generator class="sequence"/>
</id>
<set name="children" cascade="all-delete-orphan" inverse="true">
<key column="parent"/>
<one-to-many class="Child"/>
</set>

In Child:
<composite-id>
<key-property name="name" />
<key-many-to-one name="parent" class="Parent" column="parentId" />
</composite-id>
<version column="version" name="version" type="integer" unsaved-value="negative"/>

In my code I wish to delete a few children for a parent and call a update on the parent to cascade the effect onto the chidlren. More precisely, heres what I do:
Code:
Parent p = getParent();
p.getChildren().remove(someChild);
p.update();

All work fine with my tests.. they all reflect exactly the desired behaviour.
Code:
update parent ...;
update child....;
delete from child ...;

But when the same api is called from a GUI client (I have a RMI Client Server architecture), Hibernate wouldnt issue the delete query on the children.
Code:
update parent...;
update child ...;

I doubly verified if the GUI code actually removes the desired child from the Set (Client shares the wrapped Hibernate Set class). It does so.. there is no difference between the code in my tests and the GUI client... but clearly the queries executing during the calls are different!

I hope my problem is clearly defined.. I guess the problem is with the composite id mapping, because I have successfully executed similar parent child mappings that dont need a composite id. Whats going wrong?

--
Thanks.
Code:


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.