|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.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,
String name)
Creates an IdGenerator which will work with the specified database. |
Method Summary | |
---|---|
BigDecimal |
getIdAsBigDecimal(Connection connection,
Object keyInfo)
Retrieves an id as a BigDecimal. |
int |
getIdAsInt(Connection connection,
Object keyInfo)
Retrieves an id as an int. |
long |
getIdAsLong(Connection connection,
Object keyInfo)
Retrieves an id as an long. |
String |
getIdAsString(Connection connection,
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, 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(Connection connection, Object keyInfo) throws Exception
getIdAsInt
in interface IdGenerator
connection
- A Connection.keyInfo
- an Object that contains additional info.
Exception
- Database error.public long getIdAsLong(Connection connection, Object keyInfo) throws Exception
getIdAsLong
in interface IdGenerator
connection
- A Connection.keyInfo
- an Object that contains additional info.
Exception
- Database error.public BigDecimal getIdAsBigDecimal(Connection connection, Object keyInfo) throws Exception
getIdAsBigDecimal
in interface IdGenerator
connection
- A Connection.keyInfo
- an Object that contains additional info.
Exception
- Database error.public String getIdAsString(Connection connection, Object keyInfo) throws Exception
getIdAsString
in interface IdGenerator
connection
- A Connection.keyInfo
- an Object that contains additional info.
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 |