org.exolab.castor.jdo.drivers

Class MaxKeyGeneratorFactory

Implemented Interfaces:
KeyGeneratorFactory

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

Method Summary

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

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 "MAX"
Specified by:
getName in interface KeyGeneratorFactory

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