-->
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: problem with updating (primary key and unique)
PostPosted: Fri Jan 25, 2008 11:00 pm 
Newbie

Joined: Fri Jan 25, 2008 10:43 pm
Posts: 1
Hi, i am not very experienced using Hibernate, so please forgive me if my question is stupid ;)

I've got a problem with updating the record (one field is a primary key and the second is unique) in the same transaction:
because i want to update primary key, i have to delete the old record(object) and create a new one.
but this table has second field - which is unique.
that's where the problem is - hibernate seems to delete the object when the commit is executed and when it's got a new object created with the same field values (except the primary key which is the one i wanted to update) there is a database exception, because the value of unique field is the same as it was in the old ([not yet] deleted) object...

any suggestions how to make it work (using one transaction)?

thanks...


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jan 26, 2008 3:17 pm 
Regular
Regular

Joined: Mon Aug 20, 2007 6:47 am
Posts: 74
Location: UK
Hello. I'm not sure I can help directly, but may I ask why you need to change an entity's primary key value?


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.