public boolean procMemberInfo(int userId, int order,int day) {
boolean flag = false;
Session session = null;
Transaction ts = null;
try {
session = HibernateSessionFactory.getSession();
ts = session.beginTransaction();
CallableStatement c = ((SessionImpl) session).getBatcher()
.prepareCallableStatement("{call MemberInfo_insert(?,?,?)}");
c.setInt(1, userId);
c.setShort(2, (short)order);
c.setInt(3, day);
int ret=c.executeUpdate();
if(ret>0){
flag = true;
}
ts.commit();
return flag;
} catch (Exception ex) {
// TODO: handle exception
ex.printStackTrace();
if(ts!=null){
ts.rollback();
}
}finally{
if(session !=null){
session.close();
}
}
return flag;
}
Hibernate 调用JDBC执行存储过程
最新推荐文章于 2022-02-25 18:19:43 发布