-->
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: saveOrUpdate calling update always
PostPosted: Wed Feb 01, 2017 3:34 pm 
Newbie

Joined: Thu Nov 17, 2016 5:18 pm
Posts: 2
Hi All,
I am facing an issue like saveOrUpdate method always calling update even for new record also.
So I could not insert new record and giving following exception. I enabled TRACE and seen that update is being issued instead of insert. Any ideas about the issue pls?

Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1; nested exception is org.hibernate.StaleStateException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1

Thanks in advance


Top
 Profile  
 
 Post subject: Re: saveOrUpdate calling update always
PostPosted: Thu Feb 02, 2017 7:11 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1638
Location: Romania
You should use persist instead of the old saveOrUpdate. Check out this post for some details.

_________________
If you liked my answer, you are going to love my High-Performance Java Persistence book and my blog as well.


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.