Joined: Fri Jul 15, 2005 12:42 am Posts: 18
|
Hi
I have a bidirectional mapping implemented.
I am getting a child object and then explicitly deleting it i am getting an eception org.hibernate.ObjectDeletedException Please help
Thanks in advance
Hibernate version:3.0.5
Mapping documents: <class name="Person"> <id name="id" column="personId"> <generator class="native"/> </id> <set name="addresses" table="Address" lazy="false" inverse="true" cascade="all-delete-orphan"> <key column="personId"/> <one-to-many column="addressId" class="Address"/> </set> </class>
<class name="Address"> <id name="id" column="addressId"> <generator class="native"/> </id> <many-to-one name="person" column="personId" class = "Person" cascade = "none" not-null="true"/> </class>
Code between sessionFactory.openSession() and session.close(): address = (Address) session.get(Address.class, id); . . . session.delete(address);
Full stack trace of any exception that occurs: org.hibernate.ObjectDeletedException: deleted object would be re-saved by cascade (remove deleted object from associations): [com.transaxiom.axslogistics.fincalculation.dto.DecisionLineChargeDTO#1442] at org.hibernate.impl.SessionImpl.forceFlush(SessionImpl.java:742) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:166) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:96) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:69) at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:468) at org.hibernate.engine.Cascades$5.cascade(Cascades.java:154) at org.hibernate.engine.Cascades.cascadeAssociation(Cascades.java:771) at org.hibernate.engine.Cascades.cascade(Cascades.java:720) at org.hibernate.engine.Cascades.cascadeCollection(Cascades.java:895) at org.hibernate.engine.Cascades.cascadeAssociation(Cascades.java:792) at org.hibernate.engine.Cascades.cascade(Cascades.java:720) at org.hibernate.engine.Cascades.cascade(Cascades.java:847) at org.hibernate.event.def.AbstractFlushingEventListener.cascadeOnFlush(AbstractFlushingEventListener.java:121) at org.hibernate.event.def.AbstractFlushingEventListener.prepareEntityFlushes(AbstractFlushingEventListener.java:112) at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:59) at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:26) at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:730)
Name and version of the database you are using: Oracle 9i
|
|