toolbox.dao
Class JDBCAccess

Package class diagram package JDBCAccess
java.lang.Object
  extended by toolbox.dao.JDBCAccess

public class JDBCAccess
extends java.lang.Object

Provides low level JDBC functionality.


Constructor Summary
JDBCAccess()
          Default constructor
 
Method Summary
 int delete(java.lang.String delete, java.lang.Object[] params, java.sql.Connection conn)
          Delete entries.
 java.util.List executeCallForList(java.lang.String callStr, java.lang.Object[] params, java.sql.Connection conn, ListBuilder listBuilder)
          Prepare and execute the given procedure call and return a List of result data.
 java.lang.Object[] executeCallForOutput(java.lang.String callStr, java.lang.Object[] params, java.lang.Object[] outParams, int paramOffSet, java.sql.Connection conn)
          Prepare and execute the given procedure and return the registered output variables.
 java.lang.Object executeCallForStatus(java.lang.String callStr, java.lang.Object[] params, java.sql.Connection conn)
          Prepare and execute the given procedure and return the return status value.
 int insert(java.lang.String insert, java.lang.Object[] params, int[] types, java.sql.Connection conn)
          Insert all the entries in the given list using the provided statement.
 java.lang.Object insertAndReturnKey(java.lang.String insert, java.lang.Object[] params, int[] types, java.sql.Connection conn)
          Insert all the entries in the given list using the given statement and return an auto-generated key.
 java.util.List select(java.lang.String select, java.lang.Object[] params, java.sql.Connection conn, int maxRows, ListBuilder listBuilder, java.lang.Class returnType)
          Executes the select statement returns a list of map instances.
 java.util.List select(java.lang.String select, java.lang.Object[] params, java.sql.Connection conn, ListBuilder listBuilder, java.lang.Class returnType)
          Executes the select statement returns a list of map instances or the designated return type.
 int update(java.lang.String update, java.lang.Object[] params, int[] types, java.sql.Connection conn)
          Update all the entries in the given list using the given statement.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JDBCAccess

public JDBCAccess()
Default constructor

Method Detail

select

public java.util.List select(java.lang.String select,
                             java.lang.Object[] params,
                             java.sql.Connection conn,
                             int maxRows,
                             ListBuilder listBuilder,
                             java.lang.Class returnType)
                      throws DaoException
Executes the select statement returns a list of map instances.

Parameters:
select - The SQL select statement.
params - Object array of parameters used by the select statement
conn - Database connection.
maxRows - Maximum number of rows that result may contain. A value of 0 indicates no limit.
listBuilder - ListBuilder to use when constructing the results.
returnType - Class denoting return type.
Returns:
List of map instances or the designated return type.
Throws:
DaoException - if the select from the databasae failed.

select

public java.util.List select(java.lang.String select,
                             java.lang.Object[] params,
                             java.sql.Connection conn,
                             ListBuilder listBuilder,
                             java.lang.Class returnType)
                      throws DaoException
Executes the select statement returns a list of map instances or the designated return type.

Parameters:
select - The SQL select statement.
params - Object array of parameters used by the select statement
conn - Database connection.
listBuilder - ListBuilder to use when constructing the results.
returnType - Class denoting return type.
Returns:
List of map instances or the designated return type.
Throws:
DaoException - if the select from the databasae failed.

insert

public int insert(java.lang.String insert,
                  java.lang.Object[] params,
                  int[] types,
                  java.sql.Connection conn)
           throws DaoException
Insert all the entries in the given list using the provided statement.

Parameters:
insert - The SQL insert statement.
params - Object array containing values to insert.
types - int array containing SQL type information.
conn - Database connection.
Returns:
Return the insert count as an int.
Throws:
DaoException - if the insert to database failed.

insertAndReturnKey

public java.lang.Object insertAndReturnKey(java.lang.String insert,
                                           java.lang.Object[] params,
                                           int[] types,
                                           java.sql.Connection conn)
                                    throws DaoException
Insert all the entries in the given list using the given statement and return an auto-generated key.

Parameters:
insert - SQL insert statement.
params - Object array containing values to insert.
types - int array containing SQL type information.
conn - Database connection.
Returns:
Object containing an auto-generated key.
Throws:
DaoException - if the insert to database failed.

update

public int update(java.lang.String update,
                  java.lang.Object[] params,
                  int[] types,
                  java.sql.Connection conn)
           throws DaoException
Update all the entries in the given list using the given statement.

Parameters:
update - SQL update statement.
params - Object array containing parameters.
types - int array containing SQL type information.
conn - Database connection.
Returns:
Return the update count as an int.
Throws:
DaoException - if the insert to database failed.

delete

public int delete(java.lang.String delete,
                  java.lang.Object[] params,
                  java.sql.Connection conn)
           throws DaoException
Delete entries.

Parameters:
delete - SQL delete statement.
params - Object array containing the parameters for the delete statement.
conn - Database connection.
Returns:
Return the delete count as an int.
Throws:
DaoException - if the delete from the database failed.

executeCallForStatus

public java.lang.Object executeCallForStatus(java.lang.String callStr,
                                             java.lang.Object[] params,
                                             java.sql.Connection conn)
                                      throws DaoException
Prepare and execute the given procedure and return the return status value.

Parameters:
callStr - String containing callable statement.
params - Object array containing parameters.
conn - Database connection.
Returns:
Object containing output value.
Throws:
DaoException

executeCallForOutput

public java.lang.Object[] executeCallForOutput(java.lang.String callStr,
                                               java.lang.Object[] params,
                                               java.lang.Object[] outParams,
                                               int paramOffSet,
                                               java.sql.Connection conn)
                                        throws DaoException
Prepare and execute the given procedure and return the registered output variables.

Parameters:
callStr - String containing callable statement.
params - Object array containing parameters.
outParams - Object array containing parameters.
paramOffSet - The offset where the output parameters start.
conn - Database connection.
Returns:
Object[] containing output values.
Throws:
DaoException

executeCallForList

public java.util.List executeCallForList(java.lang.String callStr,
                                         java.lang.Object[] params,
                                         java.sql.Connection conn,
                                         ListBuilder listBuilder)
                                  throws DaoException
Prepare and execute the given procedure call and return a List of result data.

Parameters:
callStr - String containing callable statement.
params - Object array containing parameters.
conn - Database connection.
listBuilder - ListBuilder to use when constructing the results.
Returns:
List containing results.
Throws:
DaoException