-->
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: Wrong behavior for cascade delete-orphan on Mysql and Derby
PostPosted: Wed Mar 24, 2010 8:56 am 
Newbie

Joined: Fri Apr 21, 2006 6:33 am
Posts: 8
Hi all,

I have two tables "Securites" and "TradeList" . They are linked together creating a new table "SecurityTradeList" in a bi-directional association.

The problem is that the cascade delete works fine when I use MYSQL and works different when I use Apache Derby.

When I delete a record on the TradeList, MySQL deletes only the record I selected and the records on the table "SecurityTradeList".

Apache Derby deletes records on the tables "SecurityTradeList" and "Securites". That is wrong!

I created the following line in the file TradeList.hbm.xml

Code:
    <!-- Bi-Directional Associations -->
    <set cascade="delete-orphan" name="securities" table="SecurityTradeList">
      <key column="codTradeList"/>
      <many-to-many class="br.jaraujo.Security" column="codSecurity"/>
    </set>


I created the following line in the file Security.hbm.xml

Code:
    <!-- inverse="true" tells Hibernate that the class br.jaraujo.TradeList takes care of datebase updates. -->
    <set cascade="delete-orphan" inverse="true" name="tradeList" table="SecurityTradeList">
      <key column="codSecurity"/>
      <many-to-many class="br.jaraujo.TradeList" column="codTradeList"/>
    </set>


Well, I do know what can I do ! If you have any idea, please let me know !

Thanks !

Best regards,
Joao


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.