(List<Question>) session.createQuery("from Question q where q.teacher.id='"+teacherId+"' order by q.id asc limit "
+ pagePos + "," + pageSize).list();
结果:
select
question0_.id as id3_,
question0_.answer as answer3_,
question0_.category_id as category10_3_,
question0_.choice_a as choice3_3_,
question0_.choice_b as choice4_3_,
question0_.choice_c as choice5_3_,
question0_.choice_d as choice6_3_,
question0_.createDate as createDate3_,
question0_.teacher_id as teacher11_3_,
question0_.title as title3_,
question0_.type as type3_
from
_question question0_
where
question0_.teacher_id='50100'
order by
question0_.id asc
只到asc这就没了。
sql list
------解决方案--------------------
换种方式写呗
(List<Question>) session.createQuery("from Question q where q.teacher.id='"+teacherId+"' order by q.id asc ").setFirstResult(pagePos)这样写就可以了
.setMaxResutl(pageSize).list();