org.exolab.castor.jdo.keygen

Class MaxKeyGeneratorFactory

public final class MaxKeyGeneratorFactory extends Object implements KeyGeneratorFactory

MAX key generator factory. The short name of this key generator is "MAX". It uses the following alrorithm: the maximum value of the primary key is fetched and the correspondent record is locked until the end of transaction, generator returns (max + 1). The lock guarantees that key generators of concurrent transactions will not use this key value, so DuplicateKeyException is impossible. If the table is empty, generator returns 1, no lock is put, DuplicateKeyException is possible.

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

Author: Oleg Nitz

See Also: MaxKeyGenerator

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

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 "MAX"
Intalio Inc. (C) 1999-2006. All rights reserved http://www.intalio.com