org.j2ee.dao
Interface HibernateDAOAction

All Superinterfaces:
DAOAction
All Known Implementing Classes:
AbstractHibernateDAOAction

public interface HibernateDAOAction
extends DAOAction

Base interface of real actions.
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:
mochoa (mochoa@users.sourceforge.net)

Field Summary
static int DELETE
           
static int HQL_QUERY
           
static int LOAD
           
static int SAVE
           
static int SQL_QUERY
           
static int UPDATE
           
 
Method Summary
 java.lang.String getHQL()
          This method define an HQL statement to be executed.
 java.lang.String[] getNamesForParams()
          This method retuns the names for parameters to be setted to sql/hql statement.
 java.lang.Object[] getParameters()
          This method retuns the parameters to be setted to SQL/HQL statement.
 java.lang.String[] getReturnAliasForSqlQuery()
          This method is called when this action is of type SQL_QUERY.
 java.lang.Class[] getReturnClassForSqlQuery()
          This method is called when this action is of type SQL_QUERY.
 java.lang.String getSQL()
          This method define an SQL statement to be executed.
 int getStmtType()
          Return of statemnt's type.
 void handleResult()
          Handle the results of update statements.
If the statement is of type SAVE/UPDATE/DELETE (insert, update or delete), then when the execution of the statement finalize and no exception occurs, this method is call for handle the results.
 void handleResult(java.lang.Object to)
          Handle the results of load statements.
If the statement is of type LOAD (load), then when the execution of the statement finalize and no exception occurs, this method is call for handle the results.
 void handleResults(java.util.List rs)
          Handle the results of query statements.
If the statement is of type SQL_QUERY,HQL_QUERY (select), then when the execution of the statement finalize and no exception occurs, this method is call for handle the results.
 boolean isCaching()
           
 boolean isDelete()
          Returs true if this action is an DELETE statement
 boolean isHqlQuery()
          Returs true if this action is a HQL_QUERY statement
 boolean isLoad()
          Returs true if this action is an LOAD statement
 boolean isSave()
          Returs true if this action is an SAVE statement
 boolean isSqlQuery()
          Returs true if this action is a SQL_QUERY statement
 boolean isUpdate()
          Returs true if this action is an UPDATE statement
 void setCaching(boolean caching)
           
 void setStmtType(int stmtType)
          Set of statemnt's type.
 
Methods inherited from interface org.j2ee.dao.DAOAction
execute, getTO, setErrorHandler, setTO
 

Field Detail

SQL_QUERY

public static final int SQL_QUERY
See Also:
Constant Field Values

HQL_QUERY

public static final int HQL_QUERY
See Also:
Constant Field Values

SAVE

public static final int SAVE
See Also:
Constant Field Values

UPDATE

public static final int UPDATE
See Also:
Constant Field Values

DELETE

public static final int DELETE
See Also:
Constant Field Values

LOAD

public static final int LOAD
See Also:
Constant Field Values
Method Detail

getSQL

public java.lang.String getSQL()
This method define an SQL statement to be executed.

Returns:
SQL Statement

getHQL

public java.lang.String getHQL()
This method define an HQL statement to be executed.

Returns:
HQL Statement

getParameters

public java.lang.Object[] getParameters()
This method retuns the parameters to be setted to SQL/HQL statement.

Returns:
an array of Objects with the sql/hql statement parameters values.

getNamesForParams

public java.lang.String[] getNamesForParams()
This method retuns the names for parameters to be setted to sql/hql statement. If this statement has not parameters, null can be returned.

Returns:
an array of String with the sql/hqp statement parameters names.

getReturnClassForSqlQuery

public java.lang.Class[] getReturnClassForSqlQuery()
This method is called when this action is of type SQL_QUERY. Retuns the class name of the table.

Returns:
an array of Class sql statement out parameters types.

getReturnAliasForSqlQuery

public java.lang.String[] getReturnAliasForSqlQuery()
This method is called when this action is of type SQL_QUERY. Retuns the alias name of the table query.

Returns:
an array of Class sql statement out parameters types.

handleResults

public void handleResults(java.util.List rs)
                   throws java.lang.Exception
Handle the results of query statements.
If the statement is of type SQL_QUERY,HQL_QUERY (select), then when the execution of the statement finalize and no exception occurs, this method is call for handle the results.

Parameters:
rs - ResultSet returned by query.
java.lang.Exception

handleResult

public void handleResult()
                  throws java.lang.Exception
Handle the results of update statements.
If the statement is of type SAVE/UPDATE/DELETE (insert, update or delete), then when the execution of the statement finalize and no exception occurs, this method is call for handle the results.

java.lang.Exception

handleResult

public void handleResult(java.lang.Object to)
                  throws java.lang.Exception
Handle the results of load statements.
If the statement is of type LOAD (load), then when the execution of the statement finalize and no exception occurs, this method is call for handle the results.

Parameters:
to - the trasnfer object loaded.
java.lang.Exception

getStmtType

public int getStmtType()
Return of statemnt's type.

Returns:
one of this (SQL_QUERY,HQL_QUERY,SAVE,UPDATE,DELETE).

setStmtType

public void setStmtType(int stmtType)
Set of statemnt's type.

Parameters:
stmtType - one of this (SQL_QUERY,HQL_QUERY,SAVE,UPDATE,DELETE).

isSqlQuery

public boolean isSqlQuery()
Returs true if this action is a SQL_QUERY statement


isHqlQuery

public boolean isHqlQuery()
Returs true if this action is a HQL_QUERY statement


isSave

public boolean isSave()
Returs true if this action is an SAVE statement


isUpdate

public boolean isUpdate()
Returs true if this action is an UPDATE statement


isDelete

public boolean isDelete()
Returs true if this action is an DELETE statement


isLoad

public boolean isLoad()
Returs true if this action is an LOAD statement


isCaching

public boolean isCaching()

setCaching

public void setCaching(boolean caching)


Copyright © 2004 DAO Action Patterm. All Rights Reserved.