I am using hibernate 3.1 jar.
My mapping file is as follows:
<class name="QuestionnaireElement"
table="GME_QUESTIONNAIRE_ELEMENT" discriminator-value="QE"
lazy="false">
<id name="id" column="QUESTIONNAIRE_ELEMENT_ID"
unsaved-value="null">
<generator class="native">
<param
name="sequence">GME_SEQ_QUEST_ELEMENT_ID</param>
</generator></id>
<discriminator type="string"
column="TYPE"></discriminator>
<map name="labels" lazy="false" table="GME_LABEL" cascade="all">
<key column="QUESTIONNAIRE_ELEMENT_ID"/>
<index-many-to-many column="LANG_ID"
class="com.barcap.gcs.gmevents.model.reference.Language"/>
<composite-element class="Label">
<property name="name" column="TEXT" />
<property name="guestText" column="SECONDARY_TEXT" />
</composite-element></map>
<list name="rules" lazy="true" inverse="true" cascade="all">
<key column="PARENT_ID" not-null="true" update="false"/>
<list-index column="POSITION"/>
<one-to-many class="Rule" />
</list>
<subclass name="TextBlock" discriminator-value="TX">
-----
</subclass>
---
</class>
WHen I create a Question for the first time it dows not throw any exception, however, when I update the same question (nothing is set on the rules list) it throws an exception-
- Unhandled Exception thrown: class
org.springframework.orm.hibernate3.HibernateSystemException
2006-10-02 19:09:59,500 ERROR
[org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/gmevent
s].[action]] - Servlet.service() for servlet action threw exception
org.springframework.orm.hibernate3.HibernateSystemException: A
collection with cascade="all-delete-orphan" was no longer referenced by
the owning entity instance:
com.barcap.gcs.gmevents.model.questionnaire.QuestionnaireElement.rules;
nested exception is org.hibernate.HibernateException: A collection with
cascade="all-delete-orphan" was no longer referenced by the owning
entity instance:
com.barcap.gcs.gmevents.model.questionnaire.QuestionnaireElement.rules
org.hibernate.HibernateException: A collection with
cascade="all-delete-orphan" was no longer referenced by the owning
entity instance:
com.barcap.gcs.gmevents.model.questionnaire.QuestionnaireElement.rules
at
org.hibernate.engine.Collections.processDereferencedCollection(Collectio
ns.java:96)
at
org.hibernate.engine.Collections.processUnreachableCollection(Collection
s.java:39)
at
org.hibernate.event.def.AbstractFlushingEventListener.flushCollections(A
bstractFlushingEventListener.java:217)
at
org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToE
xecutions(AbstractFlushingEventListener.java:77)
at
org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEv
entListener.java:26)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:985)
at
org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:333)
at
org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:10
6)
at
org.springframework.orm.hibernate3.HibernateTransactionManager.doCommit(
HibernateTransactionManager.java:584)
at
org.springframework.transaction.support.AbstractPlatformTransactionManag
er.processCommit(AbstractPlatformTransactionManager.java:496)
at
org.springframework.transaction.support.AbstractPlatformTransactionManag
er.commit(AbstractPlatformTransactionManager.java:469)
at
org.springframework.transaction.interceptor.TransactionAspectSupport.doC
ommitTransactionAfterReturning(TransactionAspectSupport.java:266)
at
org.springframework.transaction.interceptor.TransactionInterceptor.invok
e(TransactionInterceptor.java:106)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(Ref
lectiveMethodInvocation.java:170)
at
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAo
pProxy.java:176)
at $Proxy11.saveOrUpdate(Unknown Source)
at
com.barcap.gcs.gmevents.web.questionnaire.ManageQuestionsAction.save(Man
ageQuestionsAction.java:438)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at
org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.j
ava:274)
Thanks in advance for help
|