hibernate Spring 调用存储过程

来源:百度知道 编辑:UC知道 时间:2024/06/06 05:34:21
请给我hibernate 用存储过程具体代码。谢谢

getHibernateTemplate().execute(new HibernateCallback() {
public Object doInHibernate(Session session) {
try {
Connection conn = session.connection();

String sql = "{call readcountplusone(?)}";
CallableStatement stmt = conn.prepareCall(sql);
stmt.setLong(1, pojo.getId().longValue());
stmt.execute();
} catch (Exception e) {

e.printStackTrace();
}
}

return null;
}
});
使用spring提供的getHibernateTemplate调用