-->
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: cascading and many-to-many relationships doubt
PostPosted: Mon May 19, 2008 4:44 pm 
Newbie

Joined: Mon May 19, 2008 4:17 pm
Posts: 1
I have an Entity A that has a many to many association with Entity B. Something like this:

Code:
<class name="com.test.A" table="T_A">
  <id name="id" column="A_ID" unsaved-value="null">
    <generator class="increment"/>
  </id>
  <property name="name" column="A_NAME" not-null="true"/>
  <set name="collectionB" table="T_A_B" cascade="all-delete-orphan">
    <key column="A_ID" />
    <many-to-many class="com.test.B"  column="B_ID" />
  </set>
</class>

<class name="com.test.B" table="T_B">
  <id name="id" column="B_ID" unsaved-value="null">
    <generator class="increment" />
  </id>
  <property name="name" column="B_NAME" not-null="true" />
  <set name="collectionA" table="T_A_B" inverse="true">
    <key column="B_ID" />
    <many-to-many class="com.test.A" column="A_ID"/>
  </set>
</class>


The schema is T_A --< T_A_B >-- T_B

I know that if I remove the T_A_B references in A instances, when I update the A the T_A_B will be deleted. But I'd like to know what I have to do to remove the B instances when yours references was removed.

_________________
Franklin Neves


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.