oemware.core.dao
Class BaseDao

java.lang.Object
  extended by oemware.core.dao.BaseDao

public abstract class BaseDao
extends java.lang.Object

The base dao object. If the reuse connection is set to true the object is no longer thread safe.

Version:
$Id: BaseDao.java 13 2008-06-15 19:43:04Z oemware $

Field Summary
protected  java.sql.Connection mConn
           
protected  javax.sql.DataSource mDataSource
           
protected  boolean mReuseConn
           
 
Constructor Summary
BaseDao()
           
BaseDao(javax.sql.DataSource pDataSource)
           
 
Method Summary
protected  void close(java.sql.ResultSet pResultSet, java.sql.Statement pStatement)
          Close the JDBC objects.
protected  void close(java.sql.ResultSet pResultSet, java.sql.Statement pStatement, java.sql.Connection pConnection)
          Close the JDBC objects.
protected  void close(java.sql.Statement pStatement, java.sql.Connection pConnection)
          Close the JDBC objects.
protected  void closeConnection()
          Close the JDBC connection.
protected  void closeConnection(java.sql.Connection pConnection)
          Close the JDBC connection.
protected  void closeResultSet(java.sql.ResultSet pResultSet)
          Close the result set.
protected  void closeStatement(java.sql.Statement pStatement)
          Close the statement.
protected  java.sql.Connection getConnection()
          Returns a connection from the data source.
protected  java.sql.Connection getConnection(java.lang.String pUsername, java.lang.String pPassword, java.lang.String pUrl, java.lang.String pDriver)
          Returns a connection.
protected  java.sql.Timestamp getNow()
          Returns the current timestamp object.
protected  void setReuseConn(boolean pV)
          Enable connection reuse.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mReuseConn

protected boolean mReuseConn

mConn

protected java.sql.Connection mConn

mDataSource

protected javax.sql.DataSource mDataSource
Constructor Detail

BaseDao

public BaseDao()

BaseDao

public BaseDao(javax.sql.DataSource pDataSource)
Method Detail

getConnection

protected final java.sql.Connection getConnection()
                                           throws DaoException
Returns a connection from the data source.

Throws:
DaoException

getConnection

protected final java.sql.Connection getConnection(java.lang.String pUsername,
                                                  java.lang.String pPassword,
                                                  java.lang.String pUrl,
                                                  java.lang.String pDriver)
                                           throws DaoException
Returns a connection.

Parameters:
pUsername - The username.
pUrl - The url.
pDriver - The driver.
Throws:
DaoException

getNow

protected final java.sql.Timestamp getNow()
Returns the current timestamp object.

Returns:
The current timestamp.

close

protected final void close(java.sql.ResultSet pResultSet,
                           java.sql.Statement pStatement,
                           java.sql.Connection pConnection)
                    throws DaoException
Close the JDBC objects.

Parameters:
pResultSet - The result set.
pStatement - The statement.
pConnection - The connection.
Throws:
DaoException

close

protected final void close(java.sql.ResultSet pResultSet,
                           java.sql.Statement pStatement)
                    throws DaoException
Close the JDBC objects.

Parameters:
pResultSet - The result set.
pStatement - The statement.
Throws:
DaoException

close

protected final void close(java.sql.Statement pStatement,
                           java.sql.Connection pConnection)
                    throws DaoException
Close the JDBC objects.

Parameters:
pStatement - The statement.
pConnection - The connection.
Throws:
DaoException

closeConnection

protected final void closeConnection()
                              throws DaoException
Close the JDBC connection.

Throws:
DaoException

closeConnection

protected final void closeConnection(java.sql.Connection pConnection)
                              throws DaoException
Close the JDBC connection.

Parameters:
pConnection - The connection.
Throws:
DaoException

closeStatement

protected final void closeStatement(java.sql.Statement pStatement)
                             throws DaoException
Close the statement.

Parameters:
pStatement - The statement.
Throws:
DaoException

closeResultSet

protected final void closeResultSet(java.sql.ResultSet pResultSet)
                             throws DaoException
Close the result set.

Parameters:
pResultSet - The result set.
Throws:
DaoException

setReuseConn

protected final void setReuseConn(boolean pV)
Enable connection reuse. Defautl is false.

Parameters:
pV - Set to true to reuse.


Copyright © 2008 Deft Labs - Released under LGPL, Version 3.0