[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2764?page=c...
]
John Verhaeg commented on HHH-2764:
-----------------------------------
I've determined the problem, but it looks like the solution might be a bit of a mess.
The problem is when creating a copy of query results to store in the entityEntry, the
portion of the code that deals with copying the property value doesn't take into
consideration when that value is yet another entity, and ends up moving it from the
results to be returned to the user to the copy, leaving the user with null where an entity
reference should have been. It seems like the solution should involve using the
appropriate entity-mode-specific tupilizer in the deepCopy method for the property type
class, but I can't see a good way of making that available without changing the API
fairly significantly or doing something hackish like re-creating a parent component's
metamodel object.
EntityType.deepCopy needs to copy for EntityType.DOM4J
------------------------------------------------------
Key: HHH-2764
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2764
Project: Hibernate Core
Issue Type: Bug
Affects Versions: 3.2.2
Environment: Hibernate 3.2.2
Reporter: Alan Krueger
Using DOM4J with a set of composite-elements that contains a many-to-one. When loading
this from the database, the many-to-one piece of the composite-element is disappearing
from the XML. I can see the collection being built and the properties on the elements of
the collection being set, but the many-to-one property disappears after that.
Investigating this, it looks like when PersistentElementHolder.getSnapshot is called and
a deepCopy is performed, the EntityType.deepCopy method returns the value to be copied
rather than copying it. This interacts poorly with the DOM4J tree, since each Element can
only have a single Element parent. When the properties are set on this, a detach is
performed that yanks the original element out of its parent.
--
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....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira