|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.torque.oid.AutoIncrementIdGenerator
public class AutoIncrementIdGenerator
This generator works with databases that have an sql syntax that allows the retrieval of the last id used to insert a row for a Connection.
Constructor Summary | |
---|---|
AutoIncrementIdGenerator(DB dbAdapter,
String name)
Creates an IdGenerator which will work with the specified database. |
Method Summary | |
---|---|
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. |
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 AutoIncrementIdGenerator(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 final boolean isConnectionRequired()
isConnectionRequired
in interface IdGenerator
boolean
value
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |