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: Exception: Batch update returned unexpected row count...
PostPosted: Mon Nov 02, 2009 9:54 am 
Beginner
Beginner

Joined: Fri Jul 20, 2007 10:38 am
Posts: 49
Hello,

I've been looking into this but I can't get my head around this.

I'm trying to save an object that has a set included, say a User has a name and some Pets. Pets is a set and are stored in a table with a one-to-many relation to user. The dao simply does getHibernateTemplate().save(user).
For some reason I see in the logging that Hibernate tries to do a UPDATE on the pets while it should do an INSERT.
Anyone with a solution?

thanx,
lino


Top
 Profile  
 
 Post subject: Re: Exception: Batch update returned unexpected row count...
PostPosted: Mon Nov 02, 2009 9:59 am 
Beginner
Beginner

Joined: Fri Jul 20, 2007 10:38 am
Posts: 49
Let me change that to the following:
after changing the cascade property to all, Hibernate does an INSERT following a UPDATE.
The UPDATE is executed to store the references back to the user.

How do I control Hibernate to just do the INSERT properly in one go.


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.