-->
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 not reading last record of a query
PostPosted: Mon Sep 30, 2013 8:33 am 
Newbie

Joined: Mon Sep 30, 2013 8:28 am
Posts: 1
I have 10 records in SQL SERVER. I am trying to print 9 at a time for JSP Pagination . In the 1st page it is showing 9 records correctly, whereas in the 2nd page it is not showing any record:

Code:
   id      deptno  deptno2 deptno3 deptno4 deptno5
    11      9   13           
    13      9   13  12       
    14      9                           
    20      9                           
    29      99  9   13  12   
    48      9                           
    52      9   13  12         
    55      9   13  12       
    60      9   12                 
    66      9


Resulting SQL and criteria is as follows:

Code:
select top 9 this_.id_employee as id1_0_0_  this_.deptno as deptno0_0_, this_.deptno2 as deptno12_0_0_, this_.deptno3 as deptno13_0_0_, this_.deptno4 as deptno14_0_0_, this_.deptno5 as deptno15_0_0_  from hawkseye1.dbo.employee this_ where (this_.deptno=? or this_.deptno2=? or this_.deptno3=? or this_.deptno4=? or this_.deptno5=?) order by this_.name asc   

criteria.setFirstResult(startCounter); // This is 0 on 1st page, 10 on 2nd page
criteria.setMaxResults(9);


However, the
Code:
list size is 9 first time
which is correct, but on
Code:
the second page it is 0
, which should be
Code:
1


ANy thoughts?

Thanks


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.