-->
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.  [ 3 posts ] 
Author Message
 Post subject: cascade deleting on many-to-many
PostPosted: Wed Feb 04, 2004 4:01 pm 
Beginner
Beginner

Joined: Fri Jan 16, 2004 3:22 pm
Posts: 26
Hi everyone!

i'm facing a problem related to deleting a graph of objects:

i have a many to many relation between classes A and B.

B class knows about this relation, but A doesn't, i mean:

A.hbm.xml
Code:
(nothing about this many-to-many relation)


B.hbm.xml
Code:
    <set name="abs" lazy="true" table="abs">
        <key>
            <column name="bid" />
        </key>
        <many-to-many class="A">
            <column name="aid" />
        </many-to-many>
    </set>


if i try to delete an A object, i would want to also delete the associations with Bs objects, i mean to delete records in the intermediate table, however this is not happening, instead an SQL referential integrity error ocurrs.

the thing is that i have a similar configuration between class A and some class C, only difference is that both classes know about the relation, and those records in the intermediate table are deleted when i delete the A object...

A.hbm.xml
Code:
    <set name="acs" lazy="true" table="acs">
        <key>
            <column name="aid" />
        </key>
        <many-to-many class="C">
            <column name="cid" />
        </many-to-many>
    </set>


C.hbm.xml
Code:
    <set name="acs" lazy="true" table="acs">
        <key>
            <column name="cid" />
        </key>
        <many-to-many class="A">
            <column name="aid" />
        </many-to-many>
    </set>


so can anyone point me where is the problem or the correct way to do it?
i hope i'd explanied clearly enough what the issue was here.

regards![/i]


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 04, 2004 7:51 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Have a look at the LifeCycle interface

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 16, 2004 6:07 pm 
Newbie

Joined: Wed Jun 16, 2004 11:20 am
Posts: 6
I'm having the same problem.

Curious if this was solved.

I don't see how implementing LifeCycle interface would do anything here.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.