-->
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.  [ 4 posts ] 
Author Message
 Post subject: one-to-many one shoot delete
PostPosted: Thu Jul 14, 2005 9:38 am 
Newbie

Joined: Thu Jan 08, 2004 12:05 pm
Posts: 14
Hi,

I noticed that when I call clear on LookupTable.elemente hibernate make a delete for each LookupTableElement it found in the collection. Is this the corect behavior ? According to the reference guide [url]20.5.4[/url] I expected only one delete to be made.


Hibernate version:3.0.5

Code:
<hibernate-mapping>
    <class name="com.amazon.test.je.LookupTable" table="LOOKUP" lazy="false">


        <id name="id" type="integer" unsaved-value="0" column="ID">
            <generator class="native"/>
        </id>

        <property name="name" type="string" column="NAME"/>

        <set name="elemente" lazy="true" inverse="false" >
            <key column="LOOKUP_ID" not-null="true"/>
            <one-to-many   class="com.amazon.test.je.LookupTableElement"/>
        </set>
    </class>
</hibernate-mapping>


<hibernate-mapping>
    <class name="com.amazon.test.je.LookupTableElement" table="LOOKUP_ELEMENT" lazy="false">


        <id name="id" type="integer" unsaved-value="0" column="ID">
            <generator class="native"/>
        </id>

        <property name="name" type="string" column="NAME"/>


    </class>
</hibernate-mapping>




Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 14, 2005 9:44 am 
Newbie

Joined: Thu Jan 08, 2004 12:05 pm
Posts: 14
the mappings are a little old. The one-to-many relation is mapped with cascade="all-delete-orphan"


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 14, 2005 1:37 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
One shot delete is for collections of values only.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 14, 2005 1:40 pm 
Newbie

Joined: Thu Jan 08, 2004 12:05 pm
Posts: 14
It's clear now. Thanks!


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

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.