From: David C. <dco...@sp...> - 2002-02-28 17:08:06
|
In the past, we've had luck modelling a unique ID generator against a table that knows the largest unused number for each of a set of unique keys. Our provider would grab the highest unused value for the "PERSON_ID" key and increment it in the database by 100, for example. It could then serve out 100 unique IDs without the cost of hitting the database. The unique ID table had the following fields: key_name, value, buffer_size. The only cost of losing the server VM that it lived in was the unserved set of values. If this was an issue for a given table, the buffer_size field could be set to 1. Dave -----Original Message----- From: RefuX Zanzebarr To: 'arc...@li...' Sent: 2/28/02 10:03 AM Subject: [Arch4j-developers] ID Generator For the Lunch-o-Matic example I've been working on, I created an ID Generator Service for generating Primary Key IDs. I'm thinking I should probably add it into the main Arch4J. Here the current interface, how does it look? /** Service for generating IDs to be used as primary keys for the DB. * @author Jroome */ public interface IDGeneratorService { /** Get the next id * @return the next id * @param key Key to be used in generating the next id. For example the key could be a table name. Thus person table and location table could have the same ids as their primary keys. */ public IdentifierDomain getID( String key ); } Ok, I know its a simple interface, but this is an opensource project so I figure best to get the dev mailing list a little bit more active :) __________________________________________________ Do You Yahoo!? Yahoo! Greetings - Send FREE e-cards for every occasion! http://greetings.yahoo.com _______________________________________________ Arch4j-developers mailing list Arc...@li... https://lists.sourceforge.net/lists/listinfo/arch4j-developers |