-->
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: CascadeType.DELETE
PostPosted: Tue Mar 08, 2011 5:47 am 
Newbie

Joined: Sat Feb 18, 2006 1:44 am
Posts: 15
Lets say in an entity you have a field thats another entity.
Basically a join.
In the entity if you supply cascade=CascadeType.DELETE implying that deletes will be cascaded which under some scenarios may be a good idea in some cases if used carefully.

The same thing can also be done at the database level itself. When defining the Foreign key one can specify that it will cascade to delete.

If we have both what will really happen?
Will the related entities already have been deleted by the database by the time hibernate go around to deleting it?

In case it is not specified at the database and specified only using hibernate is that not too much work at the java layer for what is automatic if implemented at the database layer using the appropriate cascade when defining the foreign key.


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