org.j2ee.dao.util
Class AbstractPageByPageAction

java.lang.Object
  |
  +--org.j2ee.dao.AbstractHibernateDAOAction
        |
        +--org.j2ee.dao.util.AbstractPageByPageAction
All Implemented Interfaces:
DAOAction, HibernateDAOAction
Direct Known Subclasses:
HibernateDB2NTopWrapperAction, HibernateOracleNTopWrapperAction

public abstract class AbstractPageByPageAction
extends AbstractHibernateDAOAction

Limit—with offset Objective: Want to only get n rows in the result set, and we want the first y rows in the result set discarded. Usually only makes sense in connection with an ORDER BY expression. see http://troels.arvin.dk/db/rdbms/#select-limit-offset Last modified $Date: 2004/05/18 10:50:17 $

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

Field Summary
protected  org.j2ee.dao.HibernateDAOAction action
           
 
Fields inherited from interface org.j2ee.dao.HibernateDAOAction
DELETE, HQL_QUERY, LOAD, SAVE, SQL_QUERY, UPDATE
 
Constructor Summary
AbstractPageByPageAction()
           
AbstractPageByPageAction(int fromNo, int toNo)
           
 
Method Summary
 org.j2ee.dao.HibernateDAOAction getAction()
           
 int getFrom()
           
 java.util.List getList()
           
 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()
          Alias used into the SQL query with the sintax {alias}
 java.lang.Class[] getReturnClassForSqlQuery()
          Hibernate requieres a class for every object returned by an SQL query
abstract  java.lang.String getSQL()
          This method must return a valid SQL query, it will receive all the named parameters defined by the action object plus two aditionals parameters named firstRow and lastRow representing the values for the window to be select.
 int getTo()
           
 void handleResults(java.util.List rs)
          Called by the Processor after an SQL or HQL succefull operation
 void print()
           
 void setAction(org.j2ee.dao.HibernateDAOAction action)
           
 void setFrom(int from)
           
 void setTo(int to)
           
 
Methods inherited from class org.j2ee.dao.AbstractHibernateDAOAction
execute, getHQL, getStmtType, getTO, handleResult, handleResult, isCaching, isDelete, isHqlQuery, isLoad, isSave, isSqlQuery, isUpdate, setCaching, setErrorHandler, setStmtType, setTO
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

action

protected org.j2ee.dao.HibernateDAOAction action
Constructor Detail

AbstractPageByPageAction

public AbstractPageByPageAction()

AbstractPageByPageAction

public AbstractPageByPageAction(int fromNo,
                                int toNo)
Method Detail

getAction

public org.j2ee.dao.HibernateDAOAction getAction()

setAction

public void setAction(org.j2ee.dao.HibernateDAOAction action)
               throws java.lang.Exception
java.lang.Exception

getList

public java.util.List getList()

getSQL

public abstract java.lang.String getSQL()
This method must return a valid SQL query, it will receive all the named parameters defined by the action object plus two aditionals parameters named firstRow and lastRow representing the values for the window to be select.

Specified by:
getSQL in interface HibernateDAOAction
Overrides:
getSQL in class AbstractHibernateDAOAction
Returns:
an String database dependant syntax for Limit—with offset querys. http://troels.arvin.dk/db/rdbms/ for more information.

getParameters

public java.lang.Object[] getParameters()
Description copied from interface: HibernateDAOAction
This method retuns the parameters to be setted to SQL/HQL statement.

Specified by:
getParameters in interface HibernateDAOAction
Overrides:
getParameters in class AbstractHibernateDAOAction
Returns:
an Object array with the parameters values for the HQL or SQL query

getNamesForParams

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

Specified by:
getNamesForParams in interface HibernateDAOAction
Overrides:
getNamesForParams in class AbstractHibernateDAOAction
Returns:
an String array with the names of the parameters declared into the HQL o SQL query

getReturnClassForSqlQuery

public java.lang.Class[] getReturnClassForSqlQuery()
Description copied from class: AbstractHibernateDAOAction
Hibernate requieres a class for every object returned by an SQL query

Specified by:
getReturnClassForSqlQuery in interface HibernateDAOAction
Overrides:
getReturnClassForSqlQuery in class AbstractHibernateDAOAction
Returns:
array of Class objects return by the SQL query

getReturnAliasForSqlQuery

public java.lang.String[] getReturnAliasForSqlQuery()
Description copied from class: AbstractHibernateDAOAction
Alias used into the SQL query with the sintax {alias}

Specified by:
getReturnAliasForSqlQuery in interface HibernateDAOAction
Overrides:
getReturnAliasForSqlQuery in class AbstractHibernateDAOAction
Returns:
an array of alias used into the SQL query

handleResults

public final void handleResults(java.util.List rs)
                         throws java.sql.SQLException
Description copied from class: AbstractHibernateDAOAction
Called by the Processor after an SQL or HQL succefull operation

Specified by:
handleResults in interface HibernateDAOAction
Overrides:
handleResults in class AbstractHibernateDAOAction
Parameters:
rs - List with the object results
java.sql.SQLException

print

public void print()

setFrom

public void setFrom(int from)

getFrom

public int getFrom()

setTo

public void setTo(int to)

getTo

public int getTo()


Copyright © 2004 DAO Action Patterm. All Rights Reserved.