Package org.apache.torque.oid
Class AutoIncrementIdGenerator
java.lang.Object
org.apache.torque.oid.AbstractIdGenerator
org.apache.torque.oid.AutoIncrementIdGenerator
- All Implemented Interfaces:
IdGenerator
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
ConstructorsConstructorDescriptionAutoIncrementIdGenerator(Adapter adapter, String databaseName) Creates an IdGenerator which will work with the specified database. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanA flag to determine whether a Connection is required to generate an id.booleanA flag to determine whether Statement#getGeneratedKeys() should be used.booleanA flag to determine the timing of the id generationbooleanA flag to determine the timing of the id generationMethods inherited from class org.apache.torque.oid.AbstractIdGenerator
getId, getIdAsBigDecimal, getIdAsInt, getIdAsLong, getIdAsString, getIdSql
-
Constructor Details
-
AutoIncrementIdGenerator
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:
isPriorToInsertin interfaceIdGenerator- Specified by:
isPriorToInsertin classAbstractIdGenerator- Returns:
- a
booleanvalue
-
isPostInsert
public boolean isPostInsert()A flag to determine the timing of the id generation- Specified by:
isPostInsertin interfaceIdGenerator- Specified by:
isPostInsertin classAbstractIdGenerator- Returns:
- a
booleanvalue
-
isConnectionRequired
public final boolean isConnectionRequired()A flag to determine whether a Connection is required to generate an id.- Specified by:
isConnectionRequiredin interfaceIdGenerator- Specified by:
isConnectionRequiredin classAbstractIdGenerator- Returns:
- a
booleanvalue
-
isGetGeneratedKeysSupported
public boolean isGetGeneratedKeysSupported()A flag to determine whether Statement#getGeneratedKeys() should be used.- Specified by:
isGetGeneratedKeysSupportedin interfaceIdGenerator- Specified by:
isGetGeneratedKeysSupportedin classAbstractIdGenerator- Returns:
- a
booleanvalue
-