org.springframework.batch.item.database
Interface PagingQueryProvider

All Known Implementing Classes:
AbstractSqlPagingQueryProvider, Db2PagingQueryProvider, DerbyPagingQueryProvider, HsqlPagingQueryProvider, MySqlPagingQueryProvider, OraclePagingQueryProvider, PostgresPagingQueryProvider, SqlServerPagingQueryProvider, SqlWindowingPagingQueryProvider, SybasePagingQueryProvider

public interface PagingQueryProvider

Interface defining the functionality to be provided for generating paging queries for use with Paging Item Readers.

Since:
2.0
Author:
Thomas Risberg

Method Summary
 String generateFirstPageQuery(int pageSize)
          Generate the query that will provide the first page, limited by the page size.
 String generateJumpToItemQuery(int itemIndex, int pageSize)
          Generate the query that will provide the jump to item query.
 String generateRemainingPagesQuery(int pageSize)
          Generate the query that will provide the first page, limited by the page size.
 int getParameterCount()
          The number of parameters that are declared in the query
 void init(DataSource dataSource)
          Initialize the query provider using the provided DataSource if necessary.
 boolean isUsingNamedParameters()
          Indicate whether the generated queries use named parameter syntax.
 

Method Detail

init

void init(DataSource dataSource)
          throws Exception
Initialize the query provider using the provided DataSource if necessary.

Parameters:
dataSource - DataSource to use for any initialization
Throws:
Exception

generateFirstPageQuery

String generateFirstPageQuery(int pageSize)
Generate the query that will provide the first page, limited by the page size.

Parameters:
pageSize - number of rows to read for each page
Returns:
the generated query

generateRemainingPagesQuery

String generateRemainingPagesQuery(int pageSize)
Generate the query that will provide the first page, limited by the page size.

Parameters:
pageSize - number of rows to read for each page
Returns:
the generated query

generateJumpToItemQuery

String generateJumpToItemQuery(int itemIndex,
                               int pageSize)
Generate the query that will provide the jump to item query. The itemIndex provided could be in the middle of the page and together with the page size it will be used to calculate the last index of the preceding page to be able to retrieve the sort key for this row.

Parameters:
itemIndex - the index for the next item to be read
pageSize - number of rows to read for each page
Returns:
the generated query

getParameterCount

int getParameterCount()
The number of parameters that are declared in the query

Returns:
number of parameters

isUsingNamedParameters

boolean isUsingNamedParameters()
Indicate whether the generated queries use named parameter syntax.

Returns:
true if named parameter syntax is used


Copyright © 2009 SpringSource. All Rights Reserved.