-->
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.  [ 3 posts ] 
Author Message
 Post subject: Hibernate2 to Hibernate3 migration problem!
PostPosted: Wed Jul 20, 2005 3:19 am 
Beginner
Beginner

Joined: Fri Nov 19, 2004 6:41 am
Posts: 39
Location: Stockholm, Sweden
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:

Hibernate 3.0.5

Mapping documents:

Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:

Name and version of the database you are using:

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:


I will post more info if necessary... I've currently migrated from Hibernate2 to Hibernate3.

In a many-to-many relationship where 2 users share the same role and one of the user is deleted the role should stay 'cause it's still associated with another user.

It works fine with Hibernate2, no problem at all. But since we've been running Hibernate3 all the intermediate rows gets deleted???!!!

The difference is the query Hibernate uses.

Hibernate2: DELETE FROM user_roles WHERE role_id = AND user_id = ?

Hibernate3: DELETE FROM user_roles WHERE role_id = ?


The only thing that is changed from Hibernate2 to Hibernate3 is that we use a SqlServerUserType for our id's instead of regular strings. Otherwise EVERYTHING is exactly the same...

Why is Hibernate3 using another query?

Kind regards, Andreas Eriksson


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 20, 2005 3:22 am 
Senior
Senior

Joined: Thu May 12, 2005 11:40 pm
Posts: 125
Location: Canada
Nothing without the mapping documents and POJOs...


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 20, 2005 4:52 am 
Beginner
Beginner

Joined: Fri Nov 19, 2004 6:41 am
Posts: 39
Location: Stockholm, Sweden
Nebob wrote:
Nothing without the mapping documents and POJOs...


Yes, of course!

I'm falling back on the old deprected Lifecycle implementation for now. It worked before and works now.

I think that I need the implement both a PreDeleteEventListener (for telling Hibernate to leave veto or not on specific objects) and use a DeleteEventListener to remove associations.

Well, I'll report on my progress when I got the time to investigate...

Sorry for my non-informative post.

Have a nice day!

Regards, Andreas Eriksson


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