int page=2;//分页页码
int size=2;//列数
List<User> users=session.createQuery("select a from User a")
.setFirstResult((page-1)*size)//起始条数 start end
.setMaxResults(size)//列数
.list();
//select * from user limit 0,2 起始条数,列数
for (User user : users) {
System.out.println(user.getUserId() + "---" + user.getUserName());
}