org.exolab.castor.jdo.keygen

Class HighLowKeyGeneratorFactory

public final class HighLowKeyGeneratorFactory extends Object implements KeyGeneratorFactory

HIGH-LOW key generator factory. The short name of this key generator is "HIGH-LOW". It uses the following alrorithm: a special sequence table must be in the database with keeps the maximum key values. The name of the sequence table is a mandatory parameter of the key generator, the parameter name is "table". The name of the primary key column of the sequence table and the name of the column in which maximum values are stored are mandatory parameters with the names "key-column" and "value-column", respectively. The key column contains table names, so it must be of a character type (char or varchar). The value column contains primary key values, it must be of a numeric type (numeric or int). Key generator reads the maximum value X for the given table, writes the new value (X + N) to the sequence table and during next N calls returns values X + 1, ..., X + N without database access. Number N (which sometimes is called "grab size") is an optional parameter of the key generator, the parameter name is "grab-size", default value is "1". For example, if you want to obtain HIGH-LOW key generator with 3 digits in the LOW part of the key, you should set "grab-size" to "1000".

Version: $Revision: 6230 $ $Date: 2005-06-01 06:08:22 -0600 (Wed, 01 Jun 2005) $

Author: Oleg Nitz

See Also: HighLowKeyGenerator

Method Summary
KeyGeneratorgetKeyGenerator(PersistenceFactory factory, Properties params, int sqlType)
Produce the key generator.
StringgetName()
The short name of this key generator is "HIGH-LOW"

Method Detail

getKeyGenerator

public KeyGenerator getKeyGenerator(PersistenceFactory factory, Properties params, int sqlType)
Produce the key generator.

Parameters: factory Helper object for obtaining database-specific QuerySyntax. params Parameters for key generator.

getName

public String getName()
The short name of this key generator is "HIGH-LOW"
Intalio Inc. (C) 1999-2006. All rights reserved http://www.intalio.com