-->
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: Increase id manually?
PostPosted: Thu Jul 30, 2009 6:25 am 
Newbie

Joined: Thu Jul 30, 2009 5:58 am
Posts: 1
Hallo!

I have the following problem:

I load an object from the database. If I save the same object (never mind if I change attributes or not) I want hibernate to increase the id, i.e. hibernate should put a new object in the database and not just the same!

how can i realize that?

Thank you very much!


Top
 Profile  
 
 Post subject: Re: Increase id manually?
PostPosted: Thu Jul 30, 2009 6:34 am 
Beginner
Beginner

Joined: Wed Dec 10, 2008 5:59 am
Posts: 47
That's a requirement a little off what one usually would like things to behave.

If you want the new object (with an increased ID), why not just create a new object which you
give excactly the same values as the existing one has? Then, if you'r database support auto increment,
you should have an object with a new ID. Then, you could always delete the old object if you
do not want it.


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.