Package overit.geocall.da
Class DAUtils
java.lang.Object
overit.geocall.da.DAUtils
Utility class used to retrive information about the DA
-
Method Summary
Modifier and TypeMethodDescriptionprotected static LonggetAutoIncrementedVal(DBStatement insertDbs, PoolKit pk) protected static LonggetAutoIncrementedVal(DBStatement insertDbs, PooledConnection conn) Retrieves the new id according to the specific DB.static LonggetSequenceNextVal(PoolKit pk, String tableName, String sequenceField) Retrieves the new sequence value according to the specific DB.static LonggetSequenceNextVal(PooledConnection conn, String tableName, String sequenceField) Retrieves the new sequence value according to the specific DB.getSequenceNextVals(PoolKit pk, String tableName, long howManySequences) getSequenceNextVals(PooledConnection conn, String tableName, long howManySequences) Retrieves the new sequence values according to the specific DB.static voidsetDBMaps(DBStatement dbs, DBFieldMap fm, DBObjectMap om)
-
Method Details
-
getSequenceNextVal
public static Long getSequenceNextVal(PoolKit pk, String tableName, String sequenceField) throws DAException Retrieves the new sequence value according to the specific DB.- Parameters:
pk- The PoolKit used to retrieve the new valuetableName- String containing the name of the tablesequenceField- String containing the sequence field- Returns:
- The new sequence value
- Throws:
DAException- If there is a (blocking) data-access error, a DAException is thrown
-
getSequenceNextVals
public static Queue<Long> getSequenceNextVals(PoolKit pk, String tableName, long howManySequences) throws DAException - Parameters:
pk-PoolKitused to retrieve the new value.tableName-Stringcontaining the name of the table.howManySequences- Number of sequence values to retrieve.- Returns:
- a
Queue<Long> about the new sequence values according to the specific DB. - Throws:
DAException- In case of (blocking) data-access error.
-
getSequenceNextVal
public static Long getSequenceNextVal(PooledConnection conn, String tableName, String sequenceField) throws DAException Retrieves the new sequence value according to the specific DB.- Parameters:
conn- The connection used to retrieve the new valuetableName- String containing the name of the tablesequenceField- String containing the sequence field- Returns:
- The new sequence value
- Throws:
DAException- If there is a (blocking) data-access error, a DAException is thrown
-
getSequenceNextVals
public static Queue<Long> getSequenceNextVals(PooledConnection conn, String tableName, long howManySequences) throws DAException Retrieves the new sequence values according to the specific DB.- Parameters:
conn-PoolKitused to retrieve the new value.tableName-Stringcontaining the name of the table.howManySequences- Number of sequence values to retrieve.- Returns:
- a
Queue<Long> about the next sequence values. - Throws:
DAException- In case of (blocking) data-access error.
-
getAutoIncrementedVal
- Throws:
DAException
-
getAutoIncrementedVal
protected static Long getAutoIncrementedVal(DBStatement insertDbs, PooledConnection conn) throws DAException Retrieves the new id according to the specific DB. on other DBs we retrieve it with some query on the connection (mysql). If the value must be preset using a sequence (on oracle and postgres) the method will return null.- Parameters:
insertDbs- The statement used to retrieve the new idconn- The connection used to retrieve the new id- Returns:
- The new id (null if the value must be preset using a sequence)
- Throws:
DAException- If there is a (blocking) data-access error, a DAException is thrown
-
setDBMaps
- Parameters:
dbs- The statement used to set theDBObjectMaporDBFieldMapfm- The map used for the transformations of fields namesom- The map of objects used in this instance
-