Class DAUtils

java.lang.Object
overit.geocall.da.DAUtils

public class DAUtils extends Object
Utility class used to retrive information about the DA
  • 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 value
      tableName - String containing the name of the table
      sequenceField - 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
      Returns a Queue<Long> about the new sequence values according to the specific DB.
      Parameters:
      pk - PoolKit used to retrieve the new value.
      tableName - String containing 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 value
      tableName - String containing the name of the table
      sequenceField - 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 - PoolKit used to retrieve the new value.
      tableName - String containing 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

      protected static Long getAutoIncrementedVal(DBStatement insertDbs, PoolKit pk) throws DAException
      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 id
      conn - 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

      public static void setDBMaps(DBStatement dbs, DBFieldMap fm, DBObjectMap om)
      Sets the DBObjectMap or DBFieldMap into the DBStatement
      Parameters:
      dbs - The statement used to set the DBObjectMap or DBFieldMap
      fm - The map used for the transformations of fields names
      om - The map of objects used in this instance