Issue Type: Bug Bug
Affects Versions: 3.6.10
Assignee: Unassigned
Attachments: hibernate-map-reproducer.zip
Created: 28/Aug/12 6:19 PM
Description:

I have a Map where both the key and value are entities.
When I try to modify the map (for example, by adding an element to it), all but one of my map entries get deleted.
The two things necessary to reproduce it seem to be:
(1) The key entity has a many-to-one foreign key relationship to the value entity
(2) Both key and value entities implement equals() and hashCode(), using the unique key fields for the class
If I remove either of the above, the code works fine.
It seems to be adding my entities to the map before initializing them, so equals() always returns true (all of the unique key fields are null).

I have attached a test case that reproduces the issue.

Environment: Hibernate version 3.6.10, annotation config, any database
Project: Hibernate ORM
Priority: Critical Critical
Reporter: Elizabeth Chatman
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira