-->
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.  [ 4 posts ] 
Author Message
 Post subject: deletes with relations
PostPosted: Mon Nov 10, 2003 1:45 pm 
Newbie

Joined: Tue Oct 21, 2003 6:14 pm
Posts: 11
I have a relation A->B. one-to-one.

I want to delete both the objects as part of a transaction. Do I need to
worry about in what order I need to delete these objects.

Can I delete B first , then A and then commit transaction or do I need to
worry about constraint voilations when deleting
( eg. I would delete A first and then delete B)

While inside the transaction context do I need to worry about constraints
and voilations.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 10, 2003 1:47 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
You don't have to worry about that.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 10, 2003 7:38 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Actually you *do*, if you don't have cascade delete enabled ;-)

So enable cascade delete and you will be fine.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 10, 2003 7:40 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
P.S. Note that my comment applies to one-to-ones only. They are a bit special. In the case of many-to-ones, christian is correct.


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