-->
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: question: Cascade OnDelete Action
PostPosted: Fri Nov 28, 2008 9:54 pm 
Newbie

Joined: Fri Nov 28, 2008 4:01 pm
Posts: 2
How can I trigger Hibernate to perform an "alter table" that updates a primary key to have "On Delete" == "Cascade" in MySql ?

I would like to achieve it with annotations && not perform the SQL itself.

I need that to happen for a OneToMany relationship between 2 tables and so far the code that I have does not do it.

The "alter table" that is produces is : "alter table resv_flow add index ResvSessionID (ResvSessionID), add constraint ResvSessionID foreign key (ResvSessionID) references resv_session (RowId)"

Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 09, 2008 1:13 pm 
Newbie

Joined: Tue Jul 01, 2008 2:56 pm
Posts: 4
If hibernate also generates the Schema you can use the
Code:
@OnDelete(action=OnDeleteAction.CASCADE)

Annotation.


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.