[hibernate-issues] [Hibernate-JIRA] Resolved: (HHH-5280) Exception on unidirectional collection whose elements are owned by several collection: "java.lang.IllegalArgumentException: object is not an instance of declaring class"
Emmanuel Bernard (JIRA)
noreply at atlassian.com
Fri Jan 14 10:18:05 EST 2011
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-5280?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Emmanuel Bernard resolved HHH-5280.
-----------------------------------
Resolution: Fixed
> Exception on unidirectional collection whose elements are owned by several collection: "java.lang.IllegalArgumentException: object is not an instance of declaring class"
> -------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: HHH-5280
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5280
> Project: Hibernate Core
> Issue Type: Bug
> Components: core
> Affects Versions: 3.5.2, 3.6.0
> Environment: Hibernate 3.5.2
> Db: All? (At least h2 and mysql)
> Reporter: Benjamin Lerman
> Assignee: Emmanuel Bernard
> Priority: Critical
> Fix For: 3.6.1
>
> Attachments: hibernate-multi-parent.tgz, patch.txt, projectHbBugParentId.zip, test.entity.TestCreate.txt
>
>
> I attach a maven project showing the bug.
> I have 3 classes, A, B, C with
> C have a one-to-many unidirectional relation to B and A.
> B have a one-to-many unidirectional relation to A.
> Those relations are mapped by foreign keys.
> The cascading properties for those relations are all save-update,persist
> For each of those relations, the inverse cardinality is 1 (which means A must be associated with a B and a C, and B must be associated with a C).
> I create an instance of C that I associate to an instance of B and an instance of A, and I associate the instance of B with the instance of A.
> I then try to save C, and I get the attached exception.
> For what I understood the problem is with the method StatefulPersistenceContext.getOwnerId: this method use a cache to retrieve the parent of the instance of A, but because A has 2 different parents (the instance of B and the instance of C), it does not retrieve the right one and try to call a method on the wrong entity.
>
--
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