-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: cascade=all-delete-orphan doen't work
PostPosted: Thu Oct 07, 2004 4:30 am 
Newbie

Joined: Wed Jun 02, 2004 6:14 am
Posts: 6
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:


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.