Affects Version/s: 2.1.RC1
Fix Version/s: None
I use simple mapping. I have a husband entity containing Set of Child entities.
And Child entity:
Child entity override equals/hashCode, taking nullable "graphId" and "name" into account.
Inside transactional action, removing Child entity from parent Husband entity doesn't work via set.remove(obj), although set.contains(obj) returns true. More concretely,
children.contains(child) == true
children.remove(child) == false
When I drill into the matter, I discovered something strange. Inside ManagedFieldAccessorSet's remove method, you pass the call to delegate Set:
Strange thing is that my debugger shows that delegate field is plain java.util.HashSet containing the exact instance of element that I'm trying to remove ("o" parameter in remove method), but nonetheless it cannot find it inside to remove it. I tried executing contains method while debugging, and it cannot find the element also:
delegate.contains(o) = false
But, when I try inside my debugger to copy first the contents of delegate set to my new one, and check the existence of the element, it works then. In other words:
new HashSet(delegate).contains(o) = true
Like delegate is some strange Set impl, but my debugger shows its just plain java.util.HashSet.