Hi,
ich bekomme immer folgende Exception:
Quote:
[java] Exception in thread "main" org.hibernate.ObjectDeletedException: deleted object would be re-saved by cascade (remove deleted object from associations): [de.javafalke.jwarehouse.model.Location#10]
[java] at org.hibernate.impl.SessionImpl.forceFlush(SessionImpl.java:1014)
[java] at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:165)
[java] at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:94)
[java] at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
[java] at org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:507)
[java] at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:499)
[java] at org.hibernate.engine.CascadingAction$5.cascade(CascadingAction.java:218)
[java] at org.hibernate.engine.Cascade.cascadeToOne(Cascade.java:268)
[java] at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:216)
[java] at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:169)
[java] at org.hibernate.engine.Cascade.cascade(Cascade.java:130)
[java] at org.hibernate.event.def.AbstractFlushingEventListener.cascadeOnFlush(AbstractFlushingEventListener.java:131)
[java] at org.hibernate.event.def.AbstractFlushingEventListener.prepareEntityFlushes(AbstractFlushingEventListener.java:122)
[java] at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:65)
[java] at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:26)
[java] at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
[java] at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
[java] at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
[java] at de.javafalke.jwarehouse.PersistenceManager.delete(PersistenceManager.java:155)
[java] at de.javafalke.jwarehouse.Run.addSomethingToDB(Run.java:130)
[java] at de.javafalke.jwarehouse.Run.main(Run.java:23)
[java] Java Result: 1
Ich nehm an das ist ein Problem in den Mapping files oder? Also hier mal das hbm.xml zu Location:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="de.javafalke.jwarehouse.model.Location" table="LOCATIONS">
<id name="id" column="ID_LOCATION">
<generator class="increment"/>
</id>
<property name="name" type="string" column="NAME_LOCATION"/>
<many-to-one name="parent" cascade="all" class="de.javafalke.jwarehouse.model.Location" column="PARENT_LOCATION"/>
<list name="children" cascade="all" lazy="true">
<key column="PARENT_LOCATION"/>
<list-index column="IDX"/>
<one-to-many class="de.javafalke.jwarehouse.model.Location"/>
</list>
</class>
</hibernate-mapping>
Oder muss ich doch ganz wo anders suchen?