ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "meindert" <meind...@eduflex.com>
Subject skip Results, maxResults in statement
Date Fri, 16 Oct 2009 13:59:37 GMT
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-SqlMa
ps.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

 


Mime
View raw message