-->
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: How to alter entity ID?
PostPosted: Fri Apr 29, 2005 3:13 pm 
Senior
Senior

Joined: Tue Mar 02, 2004 6:17 pm
Posts: 151
Hibernate 3.0.2:

I want to change the ID of an entity that already been persisted, although my mapping file assigns a "native" ID generator to the Entity.

If I setId() and update(), Hibernate throws:

org.hibernate.HibernateException: identifier of an instance of com.be.desktopbeautifier.server.DefaultTheme altered from 15 to 2

What is the correct way of doing this?

Gili


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 02, 2005 7:22 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
you cannot alter and ID, you can copy the object into a new one and delete the old one.

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 02, 2005 8:13 am 
Senior
Senior

Joined: Tue Mar 02, 2004 6:17 pm
Posts: 151
emmanuel wrote:
you cannot alter and ID, you can copy the object into a new one and delete the old one.


Thanks for the help Emmanuel!

Gili


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.