org.j2ee.dao.util
Class GenericErrorHandler

java.lang.Object
  |
  +--org.j2ee.dao.util.GenericErrorHandler
All Implemented Interfaces:
DAOErrorHandler

public class GenericErrorHandler
extends java.lang.Object
implements DAOErrorHandler

This class is a Generic ErrorHandler setted by default by AbstractHibernateDAOAction and AbstractJdbcDAOAction as Error Handler. You can extend this class to provided custonized behaviour for the list of catched exceptions. Last modified $Date: 2004/05/18 10:50:17 $

Version:
$Revision: 1.1.1.1 $
Author:
mochoa (mochoa@users.sourceforge.net)
See Also:
and, AbstractJdbcDAOAction

Field Summary
 
Fields inherited from interface org.j2ee.dao.DAOErrorHandler
CHECK_CONSTRAINT_FAILED, NO_DATA_FOUND, OK, PARENT_KEY_NOT_FOUND, RESTRICT_UPDATE_DELETE, UNIQUE_CONSTRAINT_FAILED, UNKNOWN_ERROR_CODE
 
Constructor Summary
GenericErrorHandler()
           
 
Method Summary
 void checkConstraintFailed(org.j2ee.dao.DAOAction d, org.j2ee.dao.DAOActionProcessor p, java.lang.Throwable e)
          raised when some check constraint fail
 void handleError(org.j2ee.dao.DAOAction d, org.j2ee.dao.DAOActionProcessor p, java.lang.Throwable e, int internalErrorCode)
           
 void noDataFound(org.j2ee.dao.DAOAction d, org.j2ee.dao.DAOActionProcessor p, java.lang.Throwable e)
          raised when Hibernate or Toplink methed Load fail (Not Applicable for JDBC)
 void parentKeyNotFound(org.j2ee.dao.DAOAction d, org.j2ee.dao.DAOActionProcessor p, java.lang.Throwable e)
          raised when the parent key not found
 void restrictUpdateDelete(org.j2ee.dao.DAOAction d, org.j2ee.dao.DAOActionProcessor p, java.lang.Throwable e)
          raised when you try to delete or update and the foreign key fail.
 void uniqueConstraintFailed(org.j2ee.dao.DAOAction d, org.j2ee.dao.DAOActionProcessor p, java.lang.Throwable e)
          raised when some unique constraint fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GenericErrorHandler

public GenericErrorHandler()
Method Detail

noDataFound

public void noDataFound(org.j2ee.dao.DAOAction d,
                        org.j2ee.dao.DAOActionProcessor p,
                        java.lang.Throwable e)
                 throws DAOException
raised when Hibernate or Toplink methed Load fail (Not Applicable for JDBC)

Parameters:
d - (The action, which throw the exception)
p - (The current processor, usefull if you want tray to execute some action)
e - (Original exception, the SQLException or Hibernate Exception is available through e.getCause()
DAOException
See Also:
DAOException

parentKeyNotFound

public void parentKeyNotFound(org.j2ee.dao.DAOAction d,
                              org.j2ee.dao.DAOActionProcessor p,
                              java.lang.Throwable e)
                       throws DAOException
raised when the parent key not found

Parameters:
d - (The action, which throw the exception)
p - (The current processor, usefull if you want tray to execute some action)
e - (Original exception, the SQLException or Hibernate Exception is available through e.getCause()
DAOException
See Also:
DAOException

checkConstraintFailed

public void checkConstraintFailed(org.j2ee.dao.DAOAction d,
                                  org.j2ee.dao.DAOActionProcessor p,
                                  java.lang.Throwable e)
                           throws DAOException
raised when some check constraint fail

Parameters:
d - (The action, which throw the exception)
p - (The current processor, usefull if you want tray to execute some action)
e - (Original exception, the SQLException or Hibernate Exception is available through e.getCause()
DAOException
See Also:
DAOException

uniqueConstraintFailed

public void uniqueConstraintFailed(org.j2ee.dao.DAOAction d,
                                   org.j2ee.dao.DAOActionProcessor p,
                                   java.lang.Throwable e)
                            throws DAOException
raised when some unique constraint fail

Parameters:
d - (The action, which throw the exception)
p - (The current processor, usefull if you want tray to execute some action)
e - (Original exception, the SQLException or Hibernate Exception is available through e.getCause()
DAOException
See Also:
DAOException

restrictUpdateDelete

public void restrictUpdateDelete(org.j2ee.dao.DAOAction d,
                                 org.j2ee.dao.DAOActionProcessor p,
                                 java.lang.Throwable e)
                          throws DAOException
raised when you try to delete or update and the foreign key fail. (cascade delete not enable for example)

Parameters:
d - (The action, which throw the exception)
p - (The current processor, usefull if you want tray to execute some action)
e - (Original exception, the SQLException or Hibernate Exception is available through e.getCause()
DAOException
See Also:
DAOException

handleError

public void handleError(org.j2ee.dao.DAOAction d,
                        org.j2ee.dao.DAOActionProcessor p,
                        java.lang.Throwable e,
                        int internalErrorCode)
                 throws DAOException
Specified by:
handleError in interface DAOErrorHandler
Parameters:
d - DAOAction which throw the exception
p - DAOActionProcessor used the above action
e - DAOException generated by the action
internalErrorCode - returned by the error handler
Throws:
DAOException - a new exception generated by the concrete error handler


Copyright © 2004 DAO Action Patterm. All Rights Reserved.