谁能帮忙看看这个JAVA代码有没有问题?
publicIntegergetCount(Classclazz,Stringstr){try{StringqueryString="selectcount(*)from...
public Integer getCount(Class clazz, String str) {
try {
String queryString = "select count(*) from " + clazz.getName() + " " + str;
Object count = getSession().createQuery(queryString).uniqueResult();
System.out.println(count.toString());
return (Integer) count;
} catch (RuntimeException re) {
log.error("getCount failed", re);
throw re;
}
}
这个用不用关闭SESSION。 展开
try {
String queryString = "select count(*) from " + clazz.getName() + " " + str;
Object count = getSession().createQuery(queryString).uniqueResult();
System.out.println(count.toString());
return (Integer) count;
} catch (RuntimeException re) {
log.error("getCount failed", re);
throw re;
}
}
这个用不用关闭SESSION。 展开
3个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询