public T selHqlObjByPS(String hql,SqlParameter sqlParams) {
try {
session = HibernateSessionFactory.getSession();
Query q=session.createQuery(hql);
this.setParameters(q,sqlParams);
return (T)q.uniqueResult();
} catch (Exception e) {
System.out.println("selHqlObjByPS 失败");
e.printStackTrace();
return null;
} finally {
session.close();
}
}
try {
session = HibernateSessionFactory.getSession();
Query q=session.createQuery(hql);
this.setParameters(q,sqlParams);
return (T)q.uniqueResult();
} catch (Exception e) {
System.out.println("selHqlObjByPS 失败");
e.printStackTrace();
return null;
} finally {
session.close();
}
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货