|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.torque.oid.SequenceIdGenerator
public class SequenceIdGenerator
This generator works with databases that have an sql syntax for getting an id prior to inserting a row into the database.
Constructor Summary | |
---|---|
SequenceIdGenerator(DB dbAdapter,
java.lang.String name)
Creates an IdGenerator which will work with the specified database. |
Method Summary | |
---|---|
java.math.BigDecimal |
getIdAsBigDecimal(java.sql.Connection connection,
java.lang.Object keyInfo)
Retrieves an id as a BigDecimal. |
int |
getIdAsInt(java.sql.Connection connection,
java.lang.Object keyInfo)
Retrieves an id as an int. |
long |
getIdAsLong(java.sql.Connection connection,
java.lang.Object keyInfo)
Retrieves an id as an long. |
java.lang.String |
getIdAsString(java.sql.Connection connection,
java.lang.Object keyInfo)
Retrieves an id as an String. |
boolean |
isConnectionRequired()
A flag to determine whether a Connection is required to generate an id. |
boolean |
isPostInsert()
A flag to determine the timing of the id generation |
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 |
Constructor Detail |
---|
public SequenceIdGenerator(DB dbAdapter, java.lang.String name)
dbAdapter
- the adapter that knows the correct sql syntax.name
- The name of the datasource to find the correct schemaMethod Detail |
---|
public int getIdAsInt(java.sql.Connection connection, java.lang.Object keyInfo) throws java.lang.Exception
getIdAsInt
in interface IdGenerator
connection
- A Connection.keyInfo
- an Object that contains additional info.
java.lang.Exception
- Database error.public long getIdAsLong(java.sql.Connection connection, java.lang.Object keyInfo) throws java.lang.Exception
getIdAsLong
in interface IdGenerator
connection
- A Connection.keyInfo
- an Object that contains additional info.
java.lang.Exception
- Database error.public java.math.BigDecimal getIdAsBigDecimal(java.sql.Connection connection, java.lang.Object keyInfo) throws java.lang.Exception
getIdAsBigDecimal
in interface IdGenerator
connection
- A Connection.keyInfo
- an Object that contains additional info.
java.lang.Exception
- Database error.public java.lang.String getIdAsString(java.sql.Connection connection, java.lang.Object keyInfo) throws java.lang.Exception
getIdAsString
in interface IdGenerator
connection
- A Connection.keyInfo
- an Object that contains additional info.
java.lang.Exception
- Database error.public boolean isPriorToInsert()
isPriorToInsert
in interface IdGenerator
boolean
valuepublic boolean isPostInsert()
isPostInsert
in interface IdGenerator
boolean
valuepublic boolean isConnectionRequired()
isConnectionRequired
in interface IdGenerator
boolean
value
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |