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

lance obermeyer (JIRA) noreply at atlassian.com
Tue Dec 13 11:04:20 EST 2011


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

lance obermeyer commented on HHH-3799:
--------------------------------------

Since this is still listed as open, I'll add my experience.  I have encountered what looks like this issue as well.  In my case the parent.hashCode() calls child.hashCode() where child is a @OneToMany association that is FetchType.EAGER.  This is several levels down.  My collection is materialized with HQL that includes "left outer join fetch parent.child" so I was expecting the data to be present before the call to child.hashCode().

I get this in the stack trace.

org.hibernate.LazyInitializationException: illegal access to loading collection
	at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:363)
	at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:108)
	at org.hibernate.collection.PersistentSet.hashCode(PersistentSet.java:434)
	at [parent].hashCode(parent.java:307)


> 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, 3.5.1
>            Reporter: Igor Vaynberg
>            Assignee: Gail Badner
>         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.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list