不支持。用hibernate,就不要用NativeSQL,至少不要在同一个session内混用,存储过程也是native的
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调用