[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-3799) PersistentSet does not honor hashcode/equals contract when loaded eagerly

Jeff Payne (JIRA) noreply at atlassian.com
Fri Mar 6 01:11:38 EST 2009


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-3799?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=32582#action_32582 ] 

Jeff Payne commented on HHH-3799:
---------------------------------

Seems like the real problem is that the general contract of the Collection methods is broken in this scenario.  Object graph traversal is a commonly used mechanism.  In fact, isn't that one of the reasons that mapping configs allow us to define a default fetch strategy, so that when the graph is traversed we can control how the associations are loaded?

The workaround above should at least be part of the documentation as a workaround for known limitation.

Also, the documentation section cited is concerned with how the joins in the query are written, explicitly vs. implicitly.  This bug has to do with a collection association that isn't even mentioned in the query.  The query-based workaround simply eagerly fetches the many-to-one association.


> PersistentSet does not honor hashcode/equals contract when loaded eagerly
> -------------------------------------------------------------------------
>
>                 Key: HHH-3799
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3799
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.3.1
>            Reporter: Igor Vaynberg
>            Assignee: Gail Badner
>            Priority: Minor
>         Attachments: test.zip
>
>
> when persistent set is loaded eagerly in some situations it calls hashcode on its items before their field values are populated and then uses this incorrect hashcode to store them in the set. this makes set items inaccessible by any collection items that rely on hashcode such as contains(), remove(), etc.
> attached is a simple maven test project that reproduces the error, unzip and mvn test to run the test.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list