Interface KeyGeneratorFactory

All Known Implementing Classes:
HighLowKeyGeneratorFactory, IdentityKeyGeneratorFactory, MaxKeyGeneratorFactory, NoKeyGeneratorFactory, SequenceKeyGeneratorFactory, TableKeyGeneratorFactory, UUIDKeyGeneratorFactory

public interface KeyGeneratorFactory
Interface for a key generator factories. The key generator factory is used for producing key generators for concrete databases with given parameters.
Version:
$Revision: 8093 $ $Date: 2006-04-25 15:08:23 -0600 (Tue, 25 Apr 2006) $
Author:
Oleg Nitz, Ralf Joachim
  • Method Details

    • getKeyGeneratorName

      String getKeyGeneratorName()
      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.
      Returns:
      Name of the KeyGenerator used to identify key generator (types).
    • getKeyGenerator

      KeyGenerator getKeyGenerator(PersistenceFactory factory, Properties params, int sqlType) throws MappingException
      Produce the key generator.
      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.