public ApproveInfo getLastApproveInfo(int documentId) {
String hql="select app from ApproveInfo app where app.document.id =? order by id DESC";
return(ApproveInfo)getSession().createQuery(hql).setParameter(0, documentId).setMaxResults(1);
}以上是我写的hql 语句 ,我想根据where 条件得到最后一个ApproveInfo对象!
而在hibernate 中不可以使用limit !
我改成setMaxResults(1),还是不可以!怎么做比较好!
String hql="select app from ApproveInfo app where app.document.id =? order by id DESC";
return(ApproveInfo)getSession().createQuery(hql).setParameter(0, documentId).setMaxResults(1);
}以上是我写的hql 语句 ,我想根据where 条件得到最后一个ApproveInfo对象!
而在hibernate 中不可以使用limit !
我改成setMaxResults(1),还是不可以!怎么做比较好!
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货