2013-09-30 34 views
0

我在SQL SERVER中有10條記錄。我試圖一次打印9個JSP分頁。在第一頁是正確顯示9條,而在第2頁它沒有顯示任何記錄:休眠不返回最後一條記錄

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 

的HQL被genarated如下:

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); 

然而,列表大小是9 first time這是正確的,但在second pageit is 0, which should be 1

ANy的想法?

感謝

+0

什麼是你有書寫的實際HQL。生成的查詢是一個SQL而不是一個HQL。 –

+0

oops mea culpa!我正在使用一個標準,這就是我可以在日誌中看到的所有內容,您能否建議在哪裏查看 – Satya

+0

使用Hibernate標準。無需編寫HQL。 –

回答

0

修正了丟失記錄的奧祕,這是明顯的,我不得不修復櫃檯的事情。謝謝大家!