Package org.apache.torque.oid
Schnittstelle IdGenerator
- Alle bekannten Implementierungsklassen:
AbstractIdGenerator,AutoIncrementIdGenerator,IDBroker,SequenceIdGenerator
public interface IdGenerator
Interface to be implemented by id generators. It is possible
that some implementations might not require all the arguments,
for example MySQL will not require a keyInfo Object, while the
IDBroker implementation does not require a Connection as
it only rarely needs one and retrieves a connection from the
Connection pool service only when needed.
- Version:
- $Id: IdGenerator.java 1850586 2019-01-06 18:46:35Z tv $
- Autor:
- John D. McNally
-
Methodenübersicht
Modifizierer und TypMethodeBeschreibunggetIdAsBigDecimal(Connection connection, Object keyInfo) Returns an id as a BigDecimal.intgetIdAsInt(Connection connection, Object keyInfo) Returns an id as a primitive int.longgetIdAsLong(Connection connection, Object keyInfo) Returns an id as a primitive long.getIdAsString(Connection connection, Object keyInfo) Returns an id as a String.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 generation
-
Methodendetails
-
getIdAsInt
Returns an id as a primitive int. If you use numeric identifiers, it's suggested thatgetIdAsLong(Connection, Object)be used instead (due to the limited range of this method).- Parameter:
connection- The database connection to use.keyInfo- an Object that contains additional info.- Gibt zurück:
- The id as integer.
- Löst aus:
TorqueException- if a Database error occurs.
-
getIdAsLong
Returns an id as a primitive long.- Parameter:
connection- The database connection to use.keyInfo- an Object that contains additional info.- Gibt zurück:
- The id as long.
- Löst aus:
TorqueException- if a Database error occurs.
-
getIdAsBigDecimal
Returns an id as a BigDecimal.- Parameter:
connection- The database connection to use.keyInfo- an Object that contains additional info.- Gibt zurück:
- The id as BigDecimal.
- Löst aus:
TorqueException- if a Database error occurs.
-
getIdAsString
Returns an id as a String.- Parameter:
connection- The database connection to use.keyInfo- an Object that contains additional info.- Gibt zurück:
- The id as String.
- Löst aus:
TorqueException- if a Database error occurs.
-
isPriorToInsert
boolean isPriorToInsert()A flag to determine the timing of the id generation- Gibt zurück:
- a
booleanvalue
-
isPostInsert
boolean isPostInsert()A flag to determine the timing of the id generation- Gibt zurück:
- Whether id is availble post-
insert.
-
isConnectionRequired
boolean isConnectionRequired()A flag to determine whether a Connection is required to generate an id.- Gibt zurück:
- a
booleanvalue
-
isGetGeneratedKeysSupported
boolean isGetGeneratedKeysSupported()A flag to determine whether Statement#getGeneratedKeys() should be used.- Gibt zurück:
- a
booleanvalue
-