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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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 generationboolean
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
-
-
-
-
Constructor Detail
-
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 Detail
-
isPriorToInsert
public boolean isPriorToInsert()
A flag to determine the timing of the id generation- Specified by:
isPriorToInsert
in interfaceIdGenerator
- Specified by:
isPriorToInsert
in classAbstractIdGenerator
- Returns:
- a
boolean
value
-
isPostInsert
public boolean isPostInsert()
A flag to determine the timing of the id generation- Specified by:
isPostInsert
in interfaceIdGenerator
- Specified by:
isPostInsert
in classAbstractIdGenerator
- 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 interfaceIdGenerator
- Specified by:
isConnectionRequired
in classAbstractIdGenerator
- Returns:
- a
boolean
value
-
isGetGeneratedKeysSupported
public boolean isGetGeneratedKeysSupported()
A flag to determine whether Statement#getGeneratedKeys() should be used.- Specified by:
isGetGeneratedKeysSupported
in interfaceIdGenerator
- Specified by:
isGetGeneratedKeysSupported
in classAbstractIdGenerator
- Returns:
- a
boolean
value
-
-