-->
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.  [ 5 posts ] 
Author Message
 Post subject: Id generator - min & max range possible?
PostPosted: Mon Dec 01, 2003 1:05 pm 
Beginner
Beginner

Joined: Tue Nov 18, 2003 12:34 am
Posts: 39
Location: Dallas, Texas, US
Hello,
I am using "hilo" ID generator and I am wondering if there is any way to instruct the db to generate the ids in a specific range, particularly given a "start" value. I am not much familiar with hilo algorithm, but anyway, if it is not possible with hilo, is there any other generator to help achieve this?
Thank you very much.
Madhan.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 01, 2003 1:15 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Yes and no.
Since hilo use for high value the value stored in DB, the you can manually update it to DB.
No there is no special start config property.

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 01, 2003 2:00 pm 
Beginner
Beginner

Joined: Tue Nov 18, 2003 12:34 am
Posts: 39
Location: Dallas, Texas, US
Thank you! How does the hi-lo value appear in the db? I mean is there is a size proportion for the "high" and "low" digit? I set this number to an "int" and also I believe I can do some kind of bit masking and set the intial value for the "high" part if I know the structure of this number in the db.
Thanks again,
Madhan.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 01, 2003 2:03 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Only the current high-value is stored in the db, the lo-part is generated in memory only by the generator


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 01, 2003 3:09 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
you have the
<param name="max_lo">100</param> in the generator tag that let you specify the low range.

First time, Hibernate will take hi value from db, and increment a JVM counter from 1 to max_lo
id = hi *maxlo + localcount

once counter = maxlo, then it will take the next high value from the db.

Here is an article on id keys http://www.agiledata.org/essays/dataModeling101.html#AssignKeys

_________________
Emmanuel


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.