-->
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.  [ 1 post ] 
Author Message
 Post subject: Generating sequential values
PostPosted: Thu Sep 11, 2003 1:18 pm 
Newbie

Joined: Thu Sep 11, 2003 12:21 pm
Posts: 1
Hi,

I am trying to figure out a way to generate sequential values. The db2 version we are using does not support sequences.

An example of what I need to do is to generate check numbers. The check class already has a primary key that uses the identity generator. I wanted to create a method like: public static Long getNextCheckNumber(); I need to be able to set the starting check number of the sequence. I will also need this type of functionality for journal number etc. I was thinking of using a table with one record in it with a column that holds the last value used for each sequence. Then I wanted to start a transaction, lock the record, fetch the value, inc by 1, save the new value, unlock the record, end the transaction, then return the value. The application is a web application using hibernate. This application may be ran on multiple app servers connectected to the same db.

Has someone solved the above problem already using hibernate? I am sure others out there have had to generate check numbers. I would appreciate your experiance. Could someone provide me with some direction (code is very helpful).

Thanks,

Rich


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.