-->
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: custom Generator: In-Memory sequence manager ?
PostPosted: Sat Nov 29, 2003 3:14 am 
Newbie

Joined: Sat Nov 29, 2003 3:10 am
Posts: 3
Is there any thing like In-Memory sequence manager - That will improve the performance.

Only for the first time an uid request,we need to go to the database for the value of the target column in the table which stores custom sequences(for example: talbe_sequence), update it with adding a custom INCREMENT value (configure it in the specified hbm.xml), and store the currentID and maxID in memory, then all following request were performed in memory util the currentID > maxID.

Just as Jive's Sequence Manager.

Which document will tell me how can I do in this case. (ie) Will Hibernate query the DB in specified situation to get an ID and will it have some thing in memory.

Please let me know how to begin, thank u


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 29, 2003 3:23 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
<generator class="increment"/>


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 29, 2003 3:58 am 
Newbie

Joined: Sat Nov 29, 2003 3:10 am
Posts: 3
gavin wrote:
<generator class="increment"/>


Oh, not this I want.

What I need is A table to store sequences,like this:

table_sequence (block increment is 15)
=========================
tablename ---+--- id_sequence
user -----------+--- 105
company -----+---- 45
....

=========================

And there are table User and Company in DB, which ID generated in memory base on column sequence of table_sequence. Only for the time that currentID > maxID in memory, we need to go to the database for the value of next block sequence. The size of block can initialize in a file,just as hbm.xml .

Is this as well as "increment"? I don't think so...

Thanks for your reply ,gavin. I am a beginner of Hibernate, please tell me more, thanks a lot.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 29, 2003 4:01 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
oh, its "hilo", except we use multiple tables, not multiple rows of the same table. (or you can use seqhilo)


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 29, 2003 4:35 am 
Newbie

Joined: Sat Nov 29, 2003 3:10 am
Posts: 3
yes! I have checked the source of Hibernate. The case I mentioned is similar to hilo. But I don't want multiple tables and hi/lo algorithm, I want the ID is continuous.

Is that means I must custom my own generator? if true, How can I begin?
implement PersistentIdentifierGenerator ? It seem that I can't extend the TableGenerator class.

But I have an unsuccessful try to do so...

Would u tell me more detail about how to think over this case? thank u gavin!


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.