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: MySQL 5.1 and Hibernate 3 Issue
PostPosted: Tue May 12, 2009 6:30 am 
Newbie

Joined: Tue May 12, 2009 5:53 am
Posts: 1
Hello All,

Currently, I encounter a few issues between MySQL 5.1 and Hibernate 3.
I will mention 2 first. They are:
  • During hbm2ddl auto creation, all the cascade value in the Foreign Keys for On Delete and On Update is Restrict even when I put "all" and other values (E.g. delete-orphan) for the cascade attribute.
    In another words, I need to manually set the On Delete and On Update to Cascade.
  • I have simple 2 tables design. When hibernate delete a row from the parent table, not all rows in the child table related to the parent row are deleted. And for these not deleted child rows, the foreign keys are set to null by hibernate. I used the getHibernateTemplate().delete(...) method. Currenly, the only way to resolve this is to create child data objects(bean) with the childs primary key and set them into the data object of the parent row.
    However, when I use MySQL Query Browser, I only need to delete a row from the parent table to delete all the child rows.

Please advise.

Thanks.


Top
 Profile  
 
 Post subject: Re: MySQL 5.1 and Hibernate 3 Issue
PostPosted: Tue Jun 23, 2009 4:34 pm 
Beginner
Beginner

Joined: Wed Jul 14, 2004 11:51 am
Posts: 43
Did you get any luck with this? I created my own Dialect as suggested on another post as so:

Code:
import org.hibernate.dialect.MySQL5Dialect;

public class TestMySQL5Dialect extends MySQL5Dialect {
    public TestMySQL5Dialect() {
        super();
    }
   
    public boolean supportsCascadeDelete(){
        return true;
     }

}


In my case it still doesn't work but if it can get if to work for you, great. Otherwise if you found the solution please let me know

Francois


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.