题
不休眠非常查询支持使用选择min,max计数和其他sql职能?
如:
select min(p.age) from person p
感谢
解决方案
是,min()
,max()
和count()
在HQL的支持。
其他提示
这就是如何我使用Max在休眠:
public long getNextId(){
long appId;
try{
Session session = HibernateUtil.getAdmSessionFactory().getCurrentSession();
Transaction t = session.beginTransaction();
String sequel = "Select max(JAdmAppExemptionId) from JAdmAppExemption";
Query q = session.createQuery(sequel);
List currentSeq = q.list();
if(currentSeq == null){
return appId;
}else{
appId = (Long)currentSeq.get(0);
return appId+1;
}
}catch(Exception exc){
System.out.print("Unable to get latestID");
exc.printStackTrace();
}
return 0;
}
一些总的职能是支持:看看 手册
不隶属于 StackOverflow