-->
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: Howto change an Object's ID?
PostPosted: Wed Sep 08, 2010 8:23 am 
Beginner
Beginner

Joined: Tue Jul 03, 2007 8:47 am
Posts: 46
Hello,

Is there a way to change an Object's ID after it has been assigned an ID by the generator and been persisted?
I tried assiging a new ID and calling session.update(), but it seems Hibernate identifies Objects by its ID and gets confused.

I know this may sound like a strange requirement, but its a legacy database where under some special circumstances an entity gets special IDs.

Thank you in advance, Clemens


Top
 Profile  
 
 Post subject: Re: Howto change an Object's ID?
PostPosted: Wed Sep 08, 2010 11:37 am 
Beginner
Beginner

Joined: Tue Jul 03, 2007 8:47 am
Posts: 46
Ok, for now I change the ID using raw SQL - which works but is pretty hackish.
I guess if I would use an L2 cache it would mess it up a lot.

Any idea to do it a proper way?

Thanks, Clemens


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.