org.hdpagination.dataaccess.orm.jpa
Class JPAQueryTemplate

java.lang.Object
  extended by org.hdpagination.dataaccess.orm.jpa.JPAQueryTemplate
All Implemented Interfaces:
QueryTemplate

public class JPAQueryTemplate
extends java.lang.Object
implements QueryTemplate

The type of QueryTemplate to run a pagination based query against JPA.

Since:
1.0
Author:
Liangfeng Ren

Constructor Summary
JPAQueryTemplate(javax.persistence.EntityManagerFactory emFactory)
           
 
Method Summary
 int countRows(QueryCallback callback)
          query total number of records for this search
 java.util.List query(QueryCallback callback, int pageSize, int pageNo)
          execute query and return only one page of data
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JPAQueryTemplate

public JPAQueryTemplate(javax.persistence.EntityManagerFactory emFactory)
Parameters:
emFactory -
Method Detail

query

public java.util.List query(QueryCallback callback,
                            int pageSize,
                            int pageNo)
Description copied from interface: QueryTemplate
execute query and return only one page of data

Specified by:
query in interface QueryTemplate
pageSize - number of records per page
pageNo - index of current page,index begins with 0.
Returns:

countRows

public int countRows(QueryCallback callback)
Description copied from interface: QueryTemplate
query total number of records for this search

Specified by:
countRows in interface QueryTemplate
Returns:


Copyright © 2008 HDPagination All Rights Reserved.