org.exolab.castor.jdo.drivers

Class HighLowKeyGeneratorFactory

Implemented Interfaces:
KeyGeneratorFactory

public final class HighLowKeyGeneratorFactory
extends java.lang.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: 1.1.1.1 $ $Date: 2003/03/03 07:08:11 $
Author:
Oleg Nitz
See Also:
HighLowKeyGenerator

Method Summary

KeyGenerator
getKeyGenerator(PersistenceFactory factory, Properties params, int sqlType)
Produce the key generator.
String
getName()
The short name of this key generator is "HIGH-LOW"

Method Details

getKeyGenerator

public KeyGenerator getKeyGenerator(PersistenceFactory factory,
                                    Properties params,
                                    int sqlType)
            throws MappingException
Produce the key generator.
Specified by:
getKeyGenerator in interface KeyGeneratorFactory

getName

public String getName()
The short name of this key generator is "HIGH-LOW"
Specified by:
getName in interface KeyGeneratorFactory

Intalio Inc. (C) 1999-2003. All rights reserved http://www.intalio.com