|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.torque.oid.AbstractIdGenerator
public abstract class AbstractIdGenerator
This class serves as a common base class for the sequence-based and the autoincrement-based id generators
| Field Summary | |
|---|---|
protected Adapter |
adapter
The adapter that knows the correct sql syntax |
protected String |
databaseName
The internal name of the Database that this Generator is connected to. |
| Constructor Summary | |
|---|---|
AbstractIdGenerator(Adapter adapter,
String databaseName)
Creates an IdGenerator which will work with the specified database. |
|
| Method Summary | ||
|---|---|---|
protected
|
getId(Connection connection,
Object keyInfo,
RecordMapper<T> mapper)
Returns the last ID used by this connection. |
|
BigDecimal |
getIdAsBigDecimal(Connection connection,
Object keyInfo)
Returns the last ID used by this connection. |
|
int |
getIdAsInt(Connection connection,
Object keyInfo)
Returns the last ID used by this connection. |
|
long |
getIdAsLong(Connection connection,
Object keyInfo)
Returns the last ID used by this connection. |
|
String |
getIdAsString(Connection connection,
Object keyInfo)
Returns the last ID used by this connection. |
|
abstract boolean |
isConnectionRequired()
A flag to determine whether a Connection is required to generate an id. |
|
abstract boolean |
isPostInsert()
A flag to determine the timing of the id generation |
|
abstract boolean |
isPriorToInsert()
A flag to determine the timing of the id generation |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected Adapter adapter
protected String databaseName
| Constructor Detail |
|---|
public AbstractIdGenerator(Adapter adapter,
String databaseName)
adapter - the adapter that knows the correct sql syntax.databaseName - The name of the databaseName to find the correct
schema.| Method Detail |
|---|
public int getIdAsInt(Connection connection,
Object keyInfo)
throws TorqueException
getIdAsInt in interface IdGeneratorconnection - The database connection to read the new id, not null.keyInfo - the name of the table for which the id is retrieved.
TorqueException - if a database error occurs.
public long getIdAsLong(Connection connection,
Object keyInfo)
throws TorqueException
getIdAsLong in interface IdGeneratorconnection - The database connection to read the new id, not null.keyInfo - the name of the table for which the id is retrieved.
TorqueException - if a database error occurs.
public BigDecimal getIdAsBigDecimal(Connection connection,
Object keyInfo)
throws TorqueException
getIdAsBigDecimal in interface IdGeneratorconnection - The database connection to read the new id, not null.keyInfo - the name of the table for which the id is retrieved.
TorqueException - if a database error occurs.
public String getIdAsString(Connection connection,
Object keyInfo)
throws TorqueException
getIdAsString in interface IdGeneratorconnection - The database connection to read the new id, not null.keyInfo - the name of the table for which the id is retrieved.
TorqueException - if a database error occurs.public abstract boolean isPriorToInsert()
isPriorToInsert in interface IdGeneratorboolean valuepublic abstract boolean isPostInsert()
isPostInsert in interface IdGeneratorboolean valuepublic abstract boolean isConnectionRequired()
isConnectionRequired in interface IdGeneratorboolean value
protected <T> T getId(Connection connection,
Object keyInfo,
RecordMapper<T> mapper)
throws TorqueException
connection - A Connection.keyInfo - an Object that contains additional info.mapper - The RecordMapper that maps from a ResultSet to the
appropriate java object.
TorqueException - if a database error occurs.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||