Hello,
I ' ve got the problem, that I can't update my objects (Projekt). When I change to cascade=all it works, but I can't delete some Rows from the list?
What must I do?
Thanks
Claudia
Hibernate version: 2
Mapping documents:
Code:
<class name="Projekt" table="DATA_PROJEKT">
<id name="projekt_id" type="java.lang.Long">
<column name="PROJEKT_ID" sql-type="number" not-null="true" />
<generator class="sequence">
<param name="sequence">SEQ_DATA_PROJEKT</param>
</generator>
</id>
<property name="name" type="string">
<column name="NAME" sql-type="VARCHAR(100)" />
</property>
<property name="info" type="string">
<column name="INFO" sql-type="VARCHAR(100)" />
</property>
<property name="owner" type="java.lang.Long">
<column name="OWNER_USER_ID" sql-type="NUMBER" />
</property>
<property name="bearbeitet" type="java.util.Date">
<column name="LASTUPDATE" sql-type="Date" />
</property>
<list name="projektDDE" table="REF_PROJEKT_ENTITY" inverse="true" cascade="all-delete-orphan">
<key column="projekt_id"/>
<index column="projekt_entity_id"/>
<one-to-many class="RefProjektEntity" />
</list>
<list name="freigaben" table="REF_PROJEKT_FREIGABE" inverse="true" cascade="all-delete-orphan">
<key column="projekt_id"/>
<index column="ref_projekt_frei_id"/>
<one-to-many class="RefProjektFreigabe" />
</list>
</class>
<class name="RefProjektEntity" table="REF_PROJEKT_ENTITY">
<id name="refProjektEntity_id" type="java.lang.Long">
<column name="PROJEKT_ENTITY_ID" sql-type="number" not-null="true" />
<generator class="sequence">
<param name="sequence">SEQ_REF_PROJEKT_ENTITY</param>
</generator>
</id>
<property name="info" type="string">
<column name="INFO" sql-type="VARCHAR(100)" />
</property>
<property name="variante" type="string">
<column name="VARIANTE" sql-type="VARCHAR(100)" />
</property>
<!-- <property name="entity_id" type="java.lang.Long">
<column name="ENTITY_ID" sql-type="NUMBER" />
</property>-->
<many-to-one name="entity" column="entity_id" />
<property name="projekt_id" type="java.lang.Long">
<column name="Projekt_ID" sql-type="NUMBER" />
</property>
<property name="bearbeitet" type="java.util.Date">
<column name="LASTUPDATE" sql-type="DATE" />
</property>
<!-- <many-to-one name="projekt" column="projekt_id" not-null="true"/>
-->
<!-- ACTUNG HIER DARF inverse=true nicht stehen, da sonst nicht gespeichert wird !!!!!!!!!!!!!!!!!!111-->
<list name="items" table="REF_PROJEKT_DDE_DDI" lazy="true">
<key column="projekt_entity_id"/>
<index column="projekt_dde_ddi_id"/>
<!-- <one-to-many class="RefProjektDDEDDI" />-->
<composite-element class="RefProjektDDEDDI">
<property name="info" type="string">
<column name="INFO" sql-type="VARCHAR(100)" />
</property>
<property name="art_id" type="int">
<column name="ART_ID" sql-type="NUMBER" />
</property>
<many-to-one name="item" class="Item" column="ITEM_ID" />
</composite-element>
</list>
</class>
<class name="RefProjektFreigabe" table="REF_PROJEKT_FREIGABE">
<id name="refProjektFrei_id" type="java.lang.Long">
<column name="REF_PROJEKT_FREI_ID" sql-type="number" not-null="true" />
<generator class="sequence">
<param name="sequence">SEQ_FREI</param>
</generator>
</id>
<property name="user_id" type="java.lang.Long">
<column name="USER_ID" sql-type="NUMBER" />
</property>
<property name="projekt_id" type="java.lang.Long">
<column name="PROJEKT_ID" sql-type="NUMBER" />
</property>
<!--<many-to-one name="projekt" column="projekt_id" not-null="true"/>-->
<many-to-one name="recht" class="Recht" column="RECHT_ID" />
</class>
Code between sessionFactory.openSession() and session.close():Code:
session =this.getSession();
tx=session.beginTransaction();
session.saveOrUpdate(projekt);
session.flush();
tx.commit();
Full stack trace of any exception that occurs:Code:
net.sf.hibernate.HibernateException: You may not dereference a collection with cascade="all-delete-orphan"
at net.sf.hibernate.impl.SessionImpl.updateUnreachableCollection(SessionImpl.java:2910)
Name and version of the database you are using:Oracle
The generated SQL (show_sql=true):Debug level Hibernate log excerpt:Code: