org.castor.cpa.persistence.sql.keygen
Class TableKeyGeneratorFactory

java.lang.Object
  extended by org.castor.cpa.persistence.sql.keygen.TableKeyGeneratorFactory
All Implemented Interfaces:
KeyGeneratorFactory

public class TableKeyGeneratorFactory
extends Object
implements KeyGeneratorFactory

JPA-specific TABLE key generator factory. The short name of this key generator is "TABLE".

Since:
1.3.2
Author:
Werner Guttmann
See Also:
TableKeyGenerator

Field Summary
static String NAME
          Short name of this key generator factory.
 
Constructor Summary
TableKeyGeneratorFactory()
           
 
Method Summary
 KeyGenerator getKeyGenerator(PersistenceFactory factory, Properties params, int sqlType)
          Produce the key generator.
 String getKeyGeneratorName()
          Get the short name of the key generator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NAME

public static String NAME
Short name of this key generator factory.

Constructor Detail

TableKeyGeneratorFactory

public TableKeyGeneratorFactory()
Method Detail

getKeyGeneratorName

public String getKeyGeneratorName()
Description copied from interface: KeyGeneratorFactory
Get the short name of the key generator. It is used to reference key generators in a mapping configuration file. If several key generators of the same type are used for the same database, then they are referenced by aliases.

Specified by:
getKeyGeneratorName in interface KeyGeneratorFactory
Returns:
Name of the KeyGenerator used to identify key generator (types).

getKeyGenerator

public KeyGenerator getKeyGenerator(PersistenceFactory factory,
                                    Properties params,
                                    int sqlType)
                             throws MappingException
Description copied from interface: KeyGeneratorFactory
Produce the key generator.

Specified by:
getKeyGenerator in interface KeyGeneratorFactory
Parameters:
factory - Helper object for obtaining database-specific QuerySyntax.
params - Parameters for key generator.
sqlType - The SQL type of the primary key, the generated identities must have the corresponding Java type, e.g. java.sql.Types.INTEGER corresponds to java.lang.Integer, java.sql.Types.NUMERIC corresponds to java.lang.BigDecimal.
Returns:
A KeyGenerator instance.
Throws:
MappingException - If there's a problem resolving the mapping information.


Copyright © 2011. All Rights Reserved.