-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Hibernate 2 - Pagination problem using criteria
PostPosted: Tue Jul 18, 2006 8:00 am 
Newbie

Joined: Tue Jul 18, 2006 7:39 am
Posts: 1
Hi all,

I am using struts,spring and Hibernate2 ,MSSQL 2000 in my application.

I have used Criteria class to get the paginated results for my search screen.
My code looks like this,

Criteria criteria = session.createCriteria(Search.class);
criteria.setFirstResult(pageNo*pageSize)
criteria.setMaxResults(pageSize);

I have set the pagesize(Number of records to be displayed in the screen) to 10. Am getting the right output when i click the first page.The query returns top 10 records from the table.When i click the next page i.e page 2 the hibernate query generated is "select top 20..." The query should be with a limit statement like limit 10,20, right? What should i do to generate a query with limit statements.

Please help me out.

Thanks in Advance.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.