-->
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: Best practice on how to delete object references
PostPosted: Fri Oct 17, 2008 9:33 am 
Newbie

Joined: Fri Sep 26, 2008 10:48 am
Posts: 10
Hello!

I have a general question on how to delete object references.

Let's say I have two objects named Vehicle and Color. I have a unidirectional many-to-one relation from Vehicle to Color.

If I delete a Color object I understand that I have to set all references to this object to null. I'm a bit stuck with finding the best solution. I have three possibilities:

1) Check every Vehicle object for a matching Color reference and set to null
2) Make the relationship bidirectional, get Color object and do a vehicles.clear()
3) Enable "on delete set null" in the database for the relation

To me the second solution seems to be the best one. Can someone please give me some advice on that?

Thanks,

Fabian


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.