Package org.apache.torque.oid

# Class AutoIncrementIdGenerator

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

All Implemented Interfaces:
  `IdGenerator`

public class AutoIncrementIdGenerator extends AbstractIdGenerator
This generator works with databases that have an sql syntax that allows the retrieval of the last id used to insert a row for a Connection.

Version:
  $Id: AutoIncrementIdGenerator.java 1850586 2019-01-06 18:46:35Z tv $
Author:
  John D. McNally

- ## Field Summary

  ### Fields inherited from class org.apache.torque.oid.AbstractIdGenerator

  `adapter, databaseName`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `AutoIncrementIdGenerator(Adapter adapter, String databaseName)`
  Creates an IdGenerator which will work with the specified database.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `final boolean`
  `isConnectionRequired()`
  A flag to determine whether a Connection is required to generate an id.
  `boolean`
  `isGetGeneratedKeysSupported()`
  A flag to determine whether Statement#getGeneratedKeys() should be used.
  `boolean`
  `isPostInsert()`
  A flag to determine the timing of the id generation
  `boolean`
  `isPriorToInsert()`
  A flag to determine the timing of the id generation

  ### Methods inherited from class org.apache.torque.oid.AbstractIdGenerator

  `getId, getIdAsBigDecimal, getIdAsInt, getIdAsLong, getIdAsString, getIdSql`

  ### Methods inherited from class java.lang.Object

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

- ## Constructor Details

  - ### AutoIncrementIdGenerator

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

- ## Method Details

  - ### isPriorToInsert

    public boolean isPriorToInsert()
    A flag to determine the timing of the id generation
    Specified by:
      `isPriorToInsert` in interface `IdGenerator`
    Specified by:
      `isPriorToInsert` in class `AbstractIdGenerator`
    Returns:
      a `boolean` value

  - ### isPostInsert

    public boolean isPostInsert()
    A flag to determine the timing of the id generation
    Specified by:
      `isPostInsert` in interface `IdGenerator`
    Specified by:
      `isPostInsert` in class `AbstractIdGenerator`
    Returns:
      a `boolean` value

  - ### isConnectionRequired

    public final boolean isConnectionRequired()
    A flag to determine whether a Connection is required to generate an id.
    Specified by:
      `isConnectionRequired` in interface `IdGenerator`
    Specified by:
      `isConnectionRequired` in class `AbstractIdGenerator`
    Returns:
      a `boolean` value

  - ### isGetGeneratedKeysSupported

    public boolean isGetGeneratedKeysSupported()
    A flag to determine whether Statement#getGeneratedKeys() should be used.
    Specified by:
      `isGetGeneratedKeysSupported` in interface `IdGenerator`
    Specified by:
      `isGetGeneratedKeysSupported` in class `AbstractIdGenerator`
    Returns:
      a `boolean` value