-->
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.  [ 5 posts ] 
Author Message
 Post subject: Does Hibernate handle cascades itself?
PostPosted: Fri Nov 26, 2004 10:47 am 
Regular
Regular

Joined: Sun Nov 07, 2004 3:39 pm
Posts: 77
I'm trying to nail down some discrepancies in behaviour using Hibernate with MyISAM and InnoDB tables in MySQL. MyISAM tables do not provide support for foreign key constraints, unlike InnoDB, so what I'm wondering is if I specify something like 'cascade=all-delete-orphan' in my mapping file, and the underlying database tables do not supprt ON DELETE CASCADE (as in the case of MyISAM), will Hibernate handle the cascading for me?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 26, 2004 11:10 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Yes, hibernate does the cascading itself.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 26, 2004 11:26 am 
Regular
Regular

Joined: Sun Nov 07, 2004 3:39 pm
Posts: 77
michael wrote:
Yes, hibernate does the cascading itself.


OK, that's good. It must be my error, then, as cascades are not happening for me with MyISAM tables (no error is being returned, it's just not doing any cascading). I'm pretty certain my mapping files are correct, but I'd like to be absolutely certain. If I have a Parent class containing a collection of objects of the Child class and I want the deletion of a Parent to cause the automatic deletion of related Child objects, do I specify 'cascade=delete' in the mapping for the Parent only, or does it need to be specified in the Child mapping as well?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 26, 2004 5:08 pm 
Expert
Expert

Joined: Thu Jan 29, 2004 2:31 am
Posts: 362
Location: Switzerland, Bern
Did you see 16. Example: Parent/Child of the reference manual?

HTH
Ernst


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 26, 2004 8:26 pm 
Regular
Regular

Joined: Sun Nov 07, 2004 3:39 pm
Posts: 77
ernst_pluess wrote:
Did you see 16. Example: Parent/Child of the reference manual?


Yes I did. I haven't yet found a clear explanation of what the implications are of declaring the cascade at the 'many' end (i.e., the Child mapping) as well as (or instead of?) the 'one' end of the relationship. Neither have I seen any examples that demonstrate this effectively. That's why I was looking for a simple yes/no answer.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.