org.hdpagination.dataaccess.orm.jpa
Class NoParamBindJPAQueryCallback

java.lang.Object
  extended by org.hdpagination.dataaccess.orm.jpa.AbstractJPAQueryCallback
      extended by org.hdpagination.dataaccess.orm.jpa.NoParamBindJPAQueryCallback
All Implemented Interfaces:
java.io.Serializable, QueryCallback, JPAQueryCallback
Direct Known Subclasses:
DefaultJPAQueryCallback

public abstract class NoParamBindJPAQueryCallback
extends AbstractJPAQueryCallback

A subclass of AbstractJPAQueryCallback providing empty implementation of setValues(Query query). It suits for query scenario where no parameters are required to bind with.

Since:
1.0
Author:
Liangfeng Ren
See Also:
Serialized Form

Constructor Summary
NoParamBindJPAQueryCallback(java.lang.String queryStmt, java.lang.String countArgument)
           Please note, since version 1.3.2, this construct adds another argument countArgument to fix a design defect not complying with the JPA specification.
NoParamBindJPAQueryCallback(java.lang.String queryStmt, java.lang.String countArgument, java.lang.String orderBy)
           Please note, since version 1.3.2, this construct adds another argument countArgument to fix a design defect not complying with the JPA specification.
NoParamBindJPAQueryCallback(java.lang.String queryStmt, java.lang.String countArgument, java.lang.String orderBy, boolean ascending)
           Please note, since version 1.3.2, this construct adds another argument countArgument to fix a design defect not complying with the JPA specification.
 
Method Summary
abstract  java.util.List processQueriedResult(java.util.List queriedResult)
          process the result from calling javax.persistence.Query.list() method in JPAQueryTemplate.query(QueryCallback callback, int pageSize, int pageNo), and the value(java.util.List) returned by current method will be used as the return value of JPAQueryTemplate.query(QueryCallback callback, int pageSize, int pageNo).
 void setValues(javax.persistence.Query query)
          Do nothing
 
Methods inherited from class org.hdpagination.dataaccess.orm.jpa.AbstractJPAQueryCallback
getCountRecordsQueryStatement, getQueryOrder, getQueryStatement, setCountRecordsQueryStatement, setQueryOrder
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NoParamBindJPAQueryCallback

public NoParamBindJPAQueryCallback(java.lang.String queryStmt,
                                   java.lang.String countArgument)

Please note, since version 1.3.2, this construct adds another argument countArgument to fix a design defect not complying with the JPA specification. So if you upgrade from previous versions, you may find a compilation error.

Parameters:
queryStmt - JP QL (Java Persistence Query Language) query statement
countArgument - to query the total number of records, the "SELECT COUNT([countArgument]) FROM ..." statement (generated based on the query statement) needs to be executed. As specified by JPA Specification, the COUNT function takes either an identification variable or a path expression as its argument. This argument will be used as the COUNT function's argument. This argument can not be null or empty, unless the property countRecordsQueryStatement is set explicitly by calling the method NoParamBindJPAQueryCallback.setCountRecordsQueryStatement(java.lang.String) (in this case, it will be ignored).

NoParamBindJPAQueryCallback

public NoParamBindJPAQueryCallback(java.lang.String queryStmt,
                                   java.lang.String countArgument,
                                   java.lang.String orderBy)

Please note, since version 1.3.2, this construct adds another argument countArgument to fix a design defect not complying with the JPA specification. So if you upgrade from previous versions, you may find a compilation error.

Parameters:
queryStmt - JP QL (Java Persistence Query Language) query statement
countArgument - to query the total number of records, the "SELECT COUNT([countArgument]) FROM ..." statement (generated based on the query statement) needs to be executed. As specified by JPA Specification, the COUNT function takes either an identification variable or a path expression as its argument. This argument will be used as the COUNT function's argument. This argument can not be null or empty, unless the property countRecordsQueryStatement is set explicitly by calling the method NoParamBindJPAQueryCallback.setCountRecordsQueryStatement(java.lang.String) (in this case, it will be ignored).
orderBy - column that will be added to the 'ORDER BY' clause of JP QL query statement

NoParamBindJPAQueryCallback

public NoParamBindJPAQueryCallback(java.lang.String queryStmt,
                                   java.lang.String countArgument,
                                   java.lang.String orderBy,
                                   boolean ascending)

Please note, since version 1.3.2, this construct adds another argument countArgument to fix a design defect not complying with the JPA specification. So if you upgrade from previous versions, you may find a compilation error.

Parameters:
queryStmt - JP QL (Java Persistence Query Language) query statement
countArgument - to query the total number of records, the "SELECT COUNT([countArgument]) FROM ..." statement (generated based on the query statement) needs to be executed. As specified by JPA Specification, the COUNT function takes either an identification variable or a path expression as its argument. This argument will be used as the COUNT function's argument. This argument can not be null or empty, unless the property countRecordsQueryStatement is set explicitly by calling the method NoParamBindJPAQueryCallback.setCountRecordsQueryStatement(java.lang.String) (in this case, it will be ignored).
orderBy - column that will be added to the 'ORDER BY' clause of JP QL query statement
ascending - if sorted by ascending order
Method Detail

setValues

public void setValues(javax.persistence.Query query)
Do nothing

Specified by:
setValues in interface JPAQueryCallback
Specified by:
setValues in class AbstractJPAQueryCallback

processQueriedResult

public abstract java.util.List processQueriedResult(java.util.List queriedResult)
Description copied from interface: JPAQueryCallback
process the result from calling javax.persistence.Query.list() method in JPAQueryTemplate.query(QueryCallback callback, int pageSize, int pageNo), and the value(java.util.List) returned by current method will be used as the return value of JPAQueryTemplate.query(QueryCallback callback, int pageSize, int pageNo).

Specified by:
processQueriedResult in interface JPAQueryCallback
Specified by:
processQueriedResult in class AbstractJPAQueryCallback
Returns:


Copyright © 2008 HDPagination All Rights Reserved.