Hibernate 休眠不返回最后一条记录
我在SQL SERVER中有10条记录。我正在尝试一次打印9个,以便JSP分页。第1页正确显示了9条记录,而第2页没有显示任何记录:Hibernate 休眠不返回最后一条记录,hibernate,jsp,sql-server-2005,Hibernate,Jsp,Sql Server 2005,我在SQL SERVER中有10条记录。我正在尝试一次打印9个,以便JSP分页。第1页正确显示了9条记录,而第2页没有显示任何记录: id deptno deptno2 deptno3 deptno4 deptno5 11 9 13 13 9 13 12 14 9 20 9
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如下所示:
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,这是正确的,但在第二页上为0,应该为1
有什么想法吗
谢谢修复了丢失的唱片之谜,它非常耀眼,我只需要修复柜台的东西。谢谢大家 您编写的实际HQL是什么。生成的查询是SQL,而不是HQL。oops意味着错误!我使用的是一个标准,这就是我在日志中看到的所有内容,您能建议在哪里查找使用的标准吗。无需编写HQL。@AbhijithNagarajan那么我在哪里犯了错误?您确定在第二次迭代中将firstResult的值设置为9吗?