-->
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: id generator increment
PostPosted: Wed Dec 29, 2004 12:03 am 
Newbie

Joined: Fri Nov 19, 2004 6:35 am
Posts: 19
Hi,
When you define your generator to be "increment", will it behave similar
to a sequence (increment by 1)?.
To my understanding, Hibernate will invisibly fetch the MAX ID in the table
where an INSERT will occur and increment it by 1.
So, in my code, i wont need to manually fetch the MAX ID.
Is my understanding correct?.

By how much will the next value be incremented?.. can it be overriden?

Cheers!.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 29, 2004 5:46 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Retrieve the max id once and then increment by 1 as per the javadoc. It is not safe in a cluster

_________________
Emmanuel


Top
 Profile  
 
 Post subject: id generator increment
PostPosted: Wed Dec 29, 2004 11:05 am 
I guess I misread the source code for IncrementGenerator.

Has anyone on this forum written a PostInsertIncrementGenerator?

I think the calculation has to happen as part of the insert or two transactions would be issued the same Id. My product has to run with a Max + 1 identity strategy because the some supported RDBMSs do not support sequences or Identity and a second VB app accesses the database directly.


Top
  
 
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.