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: Need help with Set (org.hibernate.collection.PersistentSet)
PostPosted: Tue May 03, 2005 9:00 pm 

Joined: Tue May 03, 2005 7:13 pm
Posts: 4
Used Hibernate version is 3.02

I have a simple parent-child relationship defined through <set...>
mapping (child uses many-to-one)
----------- mapping snippet from ParentClass ------------------
<!-- I also tried with out "inverse"- same results -->
----------- mapping snippet from ChildClass ------------------

All seems to be working for as long as I do not try to remove
a child from parent (child gets NULL id and is being updated in the
database by Hibernate)

-- I use opened session, I save both parent and child and I flash() --

However, when I load the parent class and look for its children
I still see the child I have removed :(

(I load Parent immediately after saving them both in the same
test method so that session and cache are still open/active)

I have done some testing and what I have found is this:
Child gets updated OK because I explilistly set its parentId to NULL
But when I try to remove child from the list - nothing happends.

I looked at run-time instance of my shild list and it is
org.hibernate.collection.PersistentSet and operations like
remove(), contains() yield no results: the child object is not found
and does not get removed.
I gone further: I do explisitly test if the same child exists in the
list by iterating through all children and I find it (child.equals() and
child.hashCode() - both yield TRUE). I have even tried to set my child
so that it references the one in the list directly
(child == childFromList is TRUE)
Still no removal.
I have lost my mind....
I have tried to use source from Hibernate but this requires so many other
libraries to be linked even at compile time that I gave up on that.

Any help?


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.