org.j2ee.dao
Class DAOJdbcActionProcessorImpl

java.lang.Object
  |
  +--org.j2ee.dao.DAOJdbcActionProcessorImpl
All Implemented Interfaces:
DAOActionProcessor

public class DAOJdbcActionProcessorImpl
extends java.lang.Object
implements DAOActionProcessor


Based on an example of book Code Notes for J2EE, Edited by GREGORY BRILL, e-ISBN 0-679-64727-9
Last modified $Date: 2004/05/18 10:50:13 $

Version:
$Revision: 1.1.1.1 $
Author:
jvlio (jvlio@users.sourceforge.net)

Constructor Summary
DAOJdbcActionProcessorImpl()
           
 
Method Summary
 void beginTransaction()
          Start a new DAO transaction.
 void closeSession()
          close a started session
 void commitTransaction()
          commit a started transaction.
 java.sql.Connection getConnection()
          Returns the JDBC Connection associated to this processor
 org.j2ee.dao.errors.ErrorMapper getErrorMapper()
          Return an ErrorMapper object to translate SQLException or other kind of exception to a common error list code
 void getSession()
          get/start a DAO Session object to be used for external controled action.
 void process(org.j2ee.dao.DAOAction acmd)
           
 void rollbackTransaction()
          rollback a started transaction.
 void setConnection(java.sql.Connection connection)
          Set a JDBC Connection to this processor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DAOJdbcActionProcessorImpl

public DAOJdbcActionProcessorImpl()
Method Detail

getErrorMapper

public org.j2ee.dao.errors.ErrorMapper getErrorMapper()
Return an ErrorMapper object to translate SQLException or other kind of exception to a common error list code

Specified by:
getErrorMapper in interface DAOActionProcessor
Returns:
ErrorMapper

process

public void process(org.j2ee.dao.DAOAction acmd)
             throws DAOException
Specified by:
process in interface DAOActionProcessor
Parameters:
acmd - An action to execute
Throws:
DAOException - if the action is not of the type espected, for example JdbcDAOAction

getConnection

public java.sql.Connection getConnection()
Description copied from interface: DAOActionProcessor
Returns the JDBC Connection associated to this processor

Specified by:
getConnection in interface DAOActionProcessor
Returns:
Connection

setConnection

public void setConnection(java.sql.Connection connection)
Description copied from interface: DAOActionProcessor
Set a JDBC Connection to this processor

Specified by:
setConnection in interface DAOActionProcessor
Parameters:
connection - Connection

getSession

public void getSession()
                throws DAOException
get/start a DAO Session object to be used for external controled action. The processor object hold the internal representation for a session. Toplink and Hibernta will hold the Session object, JDBC will use a Connection

Specified by:
getSession in interface DAOActionProcessor
Throws:
DAOException - if there are errors open the session

beginTransaction

public void beginTransaction()
                      throws DAOException
Start a new DAO transaction. This method is usefull when you need to manage Macro Actions. The first action takes the session and the transaction a pass it to the others. The processor instance will hold the Transaction object, - Toplink implementation will use UnitOfWork object. - Hibernate implementation will use Transaction object. - JDBC will use his internal JDBC Connection

Specified by:
beginTransaction in interface DAOActionProcessor
Throws:
DAOException

commitTransaction

public void commitTransaction()
                       throws DAOException
commit a started transaction.

Specified by:
commitTransaction in interface DAOActionProcessor
Throws:
DAOException

rollbackTransaction

public void rollbackTransaction()
                         throws DAOException
rollback a started transaction.

Specified by:
rollbackTransaction in interface DAOActionProcessor
Throws:
DAOException

closeSession

public void closeSession()
                  throws DAOException
close a started session

Specified by:
closeSession in interface DAOActionProcessor
Throws:
DAOException


Copyright © 2004 DAO Action Patterm. All Rights Reserved.