Package org.apache.torque.oid

# Klasse AbstractIdGenerator

java.lang.Object
org.apache.torque.oid.AbstractIdGenerator

Alle implementierten Schnittstellen:
  `IdGenerator`

Bekannte direkte Unterklassen:
  `AutoIncrementIdGenerator`, `SequenceIdGenerator`

public abstract class AbstractIdGenerator extends Object implements IdGenerator
This class serves as a common base class for the sequence-based and the autoincrement-based id generators

Version:
  $Id: AbstractIdGenerator.java 1850965 2019-01-10 17:21:29Z painter $
Autor:
  Thomas Vandahl

- ## Feldübersicht

  Felder
  Modifizierer und Typ
  Feld
  Beschreibung
  `protected Adapter`
  `adapter`
  The adapter that knows the correct sql syntax
  `protected String`
  `databaseName`
  The internal name of the Database that this Generator is connected to.

- ## Konstruktorübersicht

  Konstruktoren
  Konstruktor
  Beschreibung
  `AbstractIdGenerator(Adapter adapter, String databaseName)`
  Creates an IdGenerator which will work with the specified database.

- ## Methodenübersicht

  Modifizierer und Typ
  Methode
  Beschreibung
  `protected <T> T`
  `getId(Connection connection, Object keyInfo, RecordMapper<T> mapper)`
  Returns the last ID used by this connection.
  `BigDecimal`
  `getIdAsBigDecimal(Connection connection, Object keyInfo)`
  Returns the last ID used by this connection.
  `int`
  `getIdAsInt(Connection connection, Object keyInfo)`
  Returns the last ID used by this connection.
  `long`
  `getIdAsLong(Connection connection, Object keyInfo)`
  Returns the last ID used by this connection.
  `String`
  `getIdAsString(Connection connection, Object keyInfo)`
  Returns the last ID used by this connection.
  `String`
  `getIdSql(Object keyInfo)`
  Returns the SQL to retrieve the next id.
  `abstract boolean`
  `isConnectionRequired()`
  A flag to determine whether a Connection is required to generate an id.
  `abstract boolean`
  `isGetGeneratedKeysSupported()`
  A flag to determine whether Statement#getGeneratedKeys() should be used.
  `abstract boolean`
  `isPostInsert()`
  A flag to determine the timing of the id generation
  `abstract boolean`
  `isPriorToInsert()`
  A flag to determine the timing of the id generation

  ### Von Klasse geerbte Methoden java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Felddetails

  - ### adapter

    protected Adapter adapter
    The adapter that knows the correct sql syntax

  - ### databaseName

    protected String databaseName
    The internal name of the Database that this Generator is connected to.

- ## Konstruktordetails

  - ### AbstractIdGenerator

    public AbstractIdGenerator(Adapter adapter, String databaseName)
    Creates an IdGenerator which will work with the specified database.
    Parameter:
      `adapter` - the adapter that knows the correct sql syntax.
      `databaseName` - The name of the databaseName to find the correct schema.

- ## Methodendetails

  - ### getIdAsInt

    public int getIdAsInt(Connection connection, Object keyInfo) throws TorqueException
    Returns the last ID used by this connection.
    Angegeben von:
      `getIdAsInt` in Schnittstelle `IdGenerator`
    Parameter:
      `connection` - The database connection to read the new id, not null.
      `keyInfo` - the name of the table for which the id is retrieved.
    Gibt zurück:
      An int with the new id.
    Löst aus:
      `TorqueException` - if a database error occurs.

  - ### getIdAsLong

    public long getIdAsLong(Connection connection, Object keyInfo) throws TorqueException
    Returns the last ID used by this connection.
    Angegeben von:
      `getIdAsLong` in Schnittstelle `IdGenerator`
    Parameter:
      `connection` - The database connection to read the new id, not null.
      `keyInfo` - the name of the table for which the id is retrieved.
    Gibt zurück:
      A long with the new id.
    Löst aus:
      `TorqueException` - if a database error occurs.

  - ### getIdAsBigDecimal

    public BigDecimal getIdAsBigDecimal(Connection connection, Object keyInfo) throws TorqueException
    Returns the last ID used by this connection.
    Angegeben von:
      `getIdAsBigDecimal` in Schnittstelle `IdGenerator`
    Parameter:
      `connection` - The database connection to read the new id, not null.
      `keyInfo` - the name of the table for which the id is retrieved.
    Gibt zurück:
      A BigDecimal with the new id.
    Löst aus:
      `TorqueException` - if a database error occurs.

  - ### getIdAsString

    public String getIdAsString(Connection connection, Object keyInfo) throws TorqueException
    Returns the last ID used by this connection.
    Angegeben von:
      `getIdAsString` in Schnittstelle `IdGenerator`
    Parameter:
      `connection` - The database connection to read the new id, not null.
      `keyInfo` - the name of the table for which the id is retrieved.
    Gibt zurück:
      A String with the new id.
    Löst aus:
      `TorqueException` - if a database error occurs.

  - ### isPriorToInsert

    public abstract boolean isPriorToInsert()
    A flag to determine the timing of the id generation
    Angegeben von:
      `isPriorToInsert` in Schnittstelle `IdGenerator`
    Gibt zurück:
      a `boolean` value

  - ### isPostInsert

    public abstract boolean isPostInsert()
    A flag to determine the timing of the id generation
    Angegeben von:
      `isPostInsert` in Schnittstelle `IdGenerator`
    Gibt zurück:
      a `boolean` value

  - ### isConnectionRequired

    public abstract boolean isConnectionRequired()
    A flag to determine whether a Connection is required to generate an id.
    Angegeben von:
      `isConnectionRequired` in Schnittstelle `IdGenerator`
    Gibt zurück:
      a `boolean` value

  - ### isGetGeneratedKeysSupported

    public abstract boolean isGetGeneratedKeysSupported()
    A flag to determine whether Statement#getGeneratedKeys() should be used.
    Angegeben von:
      `isGetGeneratedKeysSupported` in Schnittstelle `IdGenerator`
    Gibt zurück:
      a `boolean` value

  - ### getId

    protected <T> T getId(Connection connection, Object keyInfo, RecordMapper<T> mapper) throws TorqueException
    Returns the last ID used by this connection.
    Typparameter:
      `T` - the id object class
    Parameter:
      `connection` - A Connection.
      `keyInfo` - an Object that contains additional info.
      `mapper` - The RecordMapper that maps from a ResultSet to the appropriate java object.
    Gibt zurück:
      The generated id.
    Löst aus:
      `TorqueException` - if a database error occurs.

  - ### getIdSql

    public String getIdSql(Object keyInfo) throws TorqueException
    Returns the SQL to retrieve the next id.
    Parameter:
      `keyInfo` - an Object that contains additional info.
    Gibt zurück:
      the SQL to retrieve the next id.
    Löst aus:
      `TorqueException` - if a database error occurs.