如何使用JPA
with从表中选择最后插入的 5 条记录Hibernate
?
public List<Sample> getAgencyChangeLastFiveRecords(){
return (ArrayList<Sample>) createQuery(
"select * from ( select * from sample order by id desc) where rownum<=5 order by rownum desc"
);
}
这是行不通的。相应的HQL
查询是什么?