Package org.apache.torque.oid
Class SequenceIdGenerator
java.lang.Object
org.apache.torque.oid.AbstractIdGenerator
org.apache.torque.oid.SequenceIdGenerator
- All Implemented Interfaces:
IdGenerator
This generator works with databases that have an sql syntax for
getting an id prior to inserting a row into the database.
- Version:
- $Id: SequenceIdGenerator.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
ConstructorsConstructorDescriptionSequenceIdGenerator(Adapter adapter, String databaseName) Creates an IdGenerator which will work with the specified database. -
Method Summary
Modifier and TypeMethodDescriptionbooleanA 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
-
SequenceIdGenerator
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 database 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 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
-