[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2656?page=c...
]
Stefan Schedl commented on HHH-2656:
------------------------------------
I have the same problem with hibernate core 3.3.2. I tried the above patch, but i need to
modify it.
my solution is
public Object fromXMLNode(Node xml, Mapping factory) throws HibernateException {
Element newXML = (Element)xml.clone();
newXML.content().clear();
newXML.attributes().clear();
newXML.attributes().addAll(((Element)xml).attributes());
newXML.content().addAll(((Element)xml).content());
newXML.setDocument(xml.getDocument());
return newXML;
}
Using EntityMode.DOM4J results in an exception when mapping more than
one collection to the root node (node=".")
----------------------------------------------------------------------------------------------------------------
Key: HHH-2656
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2656
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.2.4.sp1
Environment: Hibernate 3.2.4 SP1, tested with MySQL 5.0.
Reporter: Andries Schutte
When mapping multiple collections to the root node, an exception results (mapping and
exception stack trace is shown below). This works fine if only one collection is mapped to
the root node, or if one explicitly specifies unique names for each collection parent
node. We are unfortunately restricted by having to use customer-defined XSDs, so this is a
show-stopper for us.
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD
3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class entity-name="ProcessImpl" table="PROCESSES"
node="Process">
<id name="sysID" column="PROCESS_ID" node="sysID"
type="string"/>
<property name="version" column="PROCESS_VERSION"
node="version" type="string"/>
<property name="processType" column="PROCESS_TYPE"
node="processType" type="string"/>
<property name="status" column="PROCESS_STATE"
node="status" type="string"/>
<property name="createDate" column="PROCESS_CREATE_DATE"
node="createDate" type="timestamp"/>
<property name="creator" column="PROCESS_CREATOR"
node="creator" type="string"/>
<property name="transactionNumber" column="PROCESS_TX_NUMBER"
node="transactionNumber" type="long"/>
<property name="modifiedDate" column="PROCESS_MOD_DATE"
node="modifiedDate" type="timestamp"/>
<property name="modifier" column="PROCESS_MODIFIER"
node="modifier" type="string"/>
<property name="title" column="PROCESS_TITLE"
node="title" type="string"/>
<property name="timer" column="PROCESS_TIMER"
node="timer" type="string"/>
<property name="currentCSTime" column="PROCESS_CS_TIME"
node="currentCSTime" type="timestamp"/>
<bag name="requiredActivities"
table="REQ_ACTIVITIES" node = "."
embed-xml="true" lazy="false" cascade="all">
<key column="PROCESS_ID" not-null="true"/>
<element column="REQ_ACTIVITY" type="text"
node="requiredActivity"/>
</bag>
<bag name="retractedGuidelines"
table="RET_GUIDELINES" node = "."
embed-xml="true" lazy="false" cascade="all">
<key column="PROCESS_ID" not-null="true"/>
<element column="RET_GUIDELINE" type="text"
node="retractedGuideline"/>
</bag>
<set name="suspendedGuidelines"
node = "." embed-xml="true" lazy="false"
cascade="all">
<key column="PROCESS_ID" not-null="true"/>
<one-to-many entity-name="SuspendedGuidelineImpl"
embed-xml="true" node="suspendedGuideline"/>
</set>
</class>
</hibernate-mapping>
Exception stack trace:
[6/6/07 22:11:41:246 GMT] 00000012 SystemErr R org.hibernate.HibernateException:
Found shared references to a collection: ProcessImpl.retractedGuidelines
at org.hibernate.engine.Collections.processReachableCollection(Collections.java:163)
at org.hibernate.event.def.FlushVisitor.processCollection(FlushVisitor.java:37)
at org.hibernate.event.def.AbstractVisitor.processValue(AbstractVisitor.java:101)
at org.hibernate.event.def.AbstractVisitor.processValue(AbstractVisitor.java:61)
at
org.hibernate.event.def.AbstractVisitor.processEntityPropertyValues(AbstractVisitor.java:55)
at
org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:131)
at
org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:196)
at
org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:76)
at
org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:26)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
at
com.resonant.persistence.ExternalDataMgrHibernateDom4jImpl.persistHibernateEntity(ExternalDataMgrHibernateDom4jImpl.java:194)
at
com.resonant.persistence.ExternalDataMgrHibernateDom4jImpl.store(ExternalDataMgrHibernateDom4jImpl.java:172)
at
com.resonant.persistence.PersistenceHibernateDom4jImpl.storeObject(PersistenceHibernateDom4jImpl.java:215)
at
com.resonant.persistence.ejb.PersistenceLocalBean.storeObject(PersistenceLocalBean.java:192)
at
com.resonant.persistence.ejb.EJSLocalStatelessPersistenceLocalEJB_68e55914.storeObject(EJSLocalStatelessPersistenceLocalEJB_68e55914.java:1179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:615)
at
org.springframework.ejb.access.LocalSlsbInvokerInterceptor.invoke(LocalSlsbInvokerInterceptor.java:65)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:161)
at
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy2.storeObject(Unknown Source)
at com.resonant.hub.processmanager.ProcessHubImpl.startProcess(ProcessHubImpl.java:179)
at
com.resonant.hub.processmanager.ejb.ProcessHubBean.startProcess(ProcessHubBean.java:138)
at
com.resonant.hub.processmanager.ejb.EJSRemoteStatelessProcessHubEJB_f45832db.startProcess(EJSRemoteStatelessProcessHubEJB_f45832db.java:208)
at
com.resonant.hub.processmanager.ejb._EJSRemoteStatelessProcessHubEJB_f45832db_Tie.startProcess(_EJSRemoteStatelessProcessHubEJB_f45832db_Tie.java:261)
at
com.resonant.hub.processmanager.ejb._EJSRemoteStatelessProcessHubEJB_f45832db_Tie._invoke(_EJSRemoteStatelessProcessHubEJB_f45832db_Tie.java:122)
at com.ibm.CORBA.iiop.ServerDelegate.dispatchInvokeHandler(ServerDelegate.java:613)
at com.ibm.CORBA.iiop.ServerDelegate.dispatch(ServerDelegate.java:466)
at com.ibm.rmi.iiop.ORB.process(ORB.java:503)
at com.ibm.CORBA.iiop.ORB.process(ORB.java:1552)
at com.ibm.rmi.iiop.Connection.respondTo(Connection.java:2673)
at com.ibm.rmi.iiop.Connection.doWork(Connection.java:2551)
at com.ibm.rmi.iiop.WorkUnitImpl.doWork(WorkUnitImpl.java:62)
at com.ibm.ejs.oa.pool.PooledThread.run(ThreadPool.java:95)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1510)
--
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