Query queryHot = session.createQuery( "from HotPost ORDER BY popularity DESC"); queryHot.setFirstResult((page - 1) * pageSize); queryHot.setMaxResults(pageSize); solve: Query queryHot = session.createQuery( "from HotPost ORDER BY popularity DESC,id"); ================================== Before: id popularity 1 9 | 2 8 | page 1 3 8 | 5 8 | 6 7 | page 2 7 5 | AFTER: id popularity 1 9 | 2 8 | page 1 3 8 | 4 8 | 5 7 | page 2 6 5 |
沒有留言:
張貼留言