skip Results, maxResults in statement

View: New views
1 Messages — Rating Filter:   Alert me  

skip Results, maxResults in statement

by meindert-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

Hi All,

 

I want to use pagination as efficient as possible. Mike Haller posted a nice blog about it;

http://www.java-community.de/archives/86-Pagination-with-Apache-iBatis-SqlMaps.html

 

The problem is that I want to do the paging on the statement level, I know that that would limit the query to one database (sql Server 2005 in my case)

But is there a way to get the values of the skipResults, maxResults parameters in the statement?

 

At the moment i add a paging object to my POJO class, example;

<isNotNull property="paging.endRow"> top $paging.endRow$ ROW_NUMBER() OVER(

            Order by <isNull property="paging.sortBy">[default sorting column] DESC</isNull>

                       <isNotNull property="paging.sortBy">$sortBy$ $sortorder$</isNotNull>) as Row,

       </isNotNull>

       

    [The normal query]

  

    <isNotNull property="paging.endRow"> WHERE  Row >= #paging.startRow# AND Row &lt;= #paging.endRow# </isNotNull>

      ORDER BY <isNull property="paging.sortBy">[default sorting column]  DESC</isNull>

                   <isNotNull property="paging.sortBy">$paging.sortBy$  $paging.sortorder$</isNotNull>

 

 

 

Meindert Hoving