-->
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: ON DELETE CASCADE' to tables managed by Hibernate
PostPosted: Thu Apr 07, 2016 3:50 pm 
Beginner
Beginner

Joined: Wed Mar 03, 2010 3:35 pm
Posts: 37
Hi,
Can I add 'ON DELETE CASCADE' to tables in sql server managed by Hibernate? The entities have delete action set to cascade in the mapping, but we want to enable this in tables for those scenarios where support team runs sql delete queries directly in database.

regards
aravias


Top
 Profile  
 
 Post subject: Re: ON DELETE CASCADE' to tables managed by Hibernate
PostPosted: Fri Apr 08, 2016 1:01 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
You need to annotate your mapping with:

Code:
@OnDelete(action = OnDeleteAction.CASCADE)


Top
 Profile  
 
 Post subject: Re: ON DELETE CASCADE' to tables managed by Hibernate
PostPosted: Mon Apr 11, 2016 3:09 pm 
Beginner
Beginner

Joined: Wed Mar 03, 2010 3:35 pm
Posts: 37
can you share any code example that will help understand this annotation better? thanks,


Top
 Profile  
 
 Post subject: Re: ON DELETE CASCADE' to tables managed by Hibernate
PostPosted: Tue Apr 12, 2016 1:24 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
Sure. Here's one example.


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.