-->
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: How to implement ON DELETE SET NULL semantics?
PostPosted: Thu Apr 14, 2005 1:43 pm 
Newbie

Joined: Thu Apr 14, 2005 1:26 pm
Posts: 2
It would be nice if someone has an answer to the above question! Thanx.

Just a short description:

Two classes A and B have a one-to-many relationship (A 1 : n B), but the useful access path in my case is from B to A. So the best way to do this in Hibernate is to implement a many-to-one relationship from B to A. Now, if A gets deleted, I would like to set null the foreign keys of all affected Bs.

With SQL this is easily done with the ON DELETE SET NULL constraint. Since I don't want to use too much of SQL, is there a way to implement this in Hibernate?

Greetz

Grischa


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 15, 2005 5:48 pm 
Newbie

Joined: Thu Apr 14, 2005 1:26 pm
Posts: 2
OK, my own conclusion is: the best way is to do it at the database level.


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:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.