//sql语句
String sql = "SELECT * FROM question where id<(select max(id) from question) order by id desc;";
//创建sql查询
Query query = Model.em().createNativeQuery(sql,Question.class);
// 查询结果返回至实体对象question
List<Question> questions = query.getResultList();
//分页
ValuePaginator paginator = new ValuePaginator(questions);
paginator.setPageSize(20);
paginator.setPageNumber(1);