I had an object a of type A retieved from hibernate
Set. I did some modification to the a. During this
process, its hashCode changed. Then I would like to
remove it from the Set. I removed it like this

net.sf.hibernate.collection.Set.remove(A).

The hibernate Set can not find and remove the Object
a! If I modify the type A so that its hashCode returns
a constant value. No problem, hibernate Set can find
and remove the Object.

Below is the Set.remove() specification from Jdk 1.4.
---------------------------------------------------
Removes the specified element from this set if it is
present (optional operation). More formally, removes
an element e such that (o==null ? e==null :
o.equals(e)), if the set contains such an element.
Returns true if the set contained the specified
element (or equivalently, if the set changed as a
result of the call). (The set will not contain the
specified element once the call returns.) 
----------------------------------------------------
Notice that this spec never mentions anything about
the hashCode.
Moreover an object is only required to have a constant
hashCode value provided no information used in equals
comparisons on the object is modified. 
In hibernate current implementation, if a object is
retrieved from Set and its hashCode is changed, there
is no way to remove it from set.

Any thoughts on this?

Help is appreciated.

jason





__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com


-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel

Reply via email to