-->
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: error when adding record
PostPosted: Wed Aug 17, 2005 5:43 am 
Newbie

Joined: Wed Aug 17, 2005 5:27 am
Posts: 3
Hibernate version: 3


Hi,

When I try to save a record with a constraint violation, an exception is thrown but Hibernate generates a primary key for this object (I am using HILO to generate the PK).

when the user changes the field that generates the constraint violation and tries to save the record, I get an exception
Quote:
Unexpected row count: 0 expected: 1
.
This is becouse hibernate wants to update the record, but it is never saved.

What is the best way to solve this?

thanks


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 17, 2005 5:52 am 
Senior
Senior

Joined: Thu Aug 04, 2005 4:54 am
Posts: 153
Location: Birmingham, UK
One way, which may not be the best, would be to validate the data before saving it.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 17, 2005 5:54 am 
Newbie

Joined: Wed Aug 17, 2005 5:27 am
Posts: 3
I know, but I want the DB to do the work :-)


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.