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.  [ 2 posts ] 
Author Message
 Post subject: Delete troubles
PostPosted: Mon Mar 14, 2011 8:28 am 
Beginner
Beginner

Joined: Mon Nov 15, 2010 10:39 am
Posts: 27
Hi,

I have a set of tables, and associations between these tables as seperate tables containing a uni-directional many-to-one. If i have table A and B, and an association table AB, then table AB contains references to A and B, but A and B does not know about the AB table.

The references are mapped in AB as:

<many-to-one name="a"
column="a"
class="A"
/>

and the same for B. My problem occurs upon deleting objects. The way i would like it to work, is that when an entry in A or B is deleted, all entries in AB referencing this entry is deleted as well. I have tried using cascade="delete" on my many-to-one mappings, but this works in the wrong "direction", deleting all referenced objects when deleting an entry in AB.

Is there a way to achieve this without having to include a one-to-many mapping with a corresponding set in the referenced object?

- Tobb


Top
 Profile  
 
 Post subject: Re: Delete troubles
PostPosted: Wed Mar 16, 2011 7:20 am 
Beginner
Beginner

Joined: Mon Nov 15, 2010 10:39 am
Posts: 27
Anyone know if this is possible?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.