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: Bulk delete for a set without one-to-many relationship
PostPosted: Fri Jun 15, 2007 8:07 am 
Newbie

Joined: Fri Jun 15, 2007 7:19 am
Posts: 8
Hibernate version: 3.2.4
Database: Oracle 10
Mapping document:
Code:
<hibernate-mapping>
    <class name="PersistentClass"
           table="TEST_PERSISTENT_CLASS">

           <id name="id"
               column="PERSISTENT_CLASS_ID">
               <generator class="native" />
           </id>
           
           <property name="fieldA"
                     type="string"
                     column="FIELD_A"/>
                   
           <set name="fieldD" table="TEST_PERSISTENT_CLASS_FIELD_D">
               <key column="PERSISTENT_CLASS_ID" on-delete="cascade"/>
               <element type="string" column="FIELD_D_VALUE" not-null="true" />
           </set>
                                                               
    </class>
</hibernate-mapping>


Hello,
I'd like to do a bulk delete for the previous mapping.

To do this, at the database level, I need to set an ON DELETE CASCADE constraint on the PERSISTENT_CLASS_ID foreing key.
That's why I added the on-delete="cascade" attribute on the key of the 'fieldD' property

If I export the schema using the hbm2dll tool, the SQL script generated is correct and the ON DELETE CASCADE constraint is set.

Unfortunately, when I launch my application, I get the following exception :
Code:
  only inverse one-to-many associations may use on-delete="cascade" : PersistentClass.fieldD

If I add the inverse attribute to the set, the result is the same.

Is there a way to get a simple (I mean without a one-to-many relationship) set (or map, that's the same problem) property working for a bulk delete?

Thank you


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.