Hibernate 中调用存储过程
public void executeproc() {
execute(new HibernateCallback() {
@SuppressWarnings("deprecation")
public Object doInHibernate(Session session)
throws HibernateException, SQLException {
CallableStatement cs =
session.connection().prepareCall("{call proc_test(?)}");
cs.setString(1, "test2");
cs.execute();
cs.close();
return null;
}
});
}
jdbc 调用存储过程
Class.forName(driver);
conn = DriverManager.getConnection(url, " root ", " ");
CallableStatement proc = null;
proc = conn.prepareCall("{ call proc_test(?) }");
proc.setString(1, "TestOne");
proc.execute();
proc.close();
public void executeproc() {
execute(new HibernateCallback() {
@SuppressWarnings("deprecation")
public Object doInHibernate(Session session)
throws HibernateException, SQLException {
CallableStatement cs =
session.connection().prepareCall("{call proc_test(?)}");
cs.setString(1, "test2");
cs.execute();
cs.close();
return null;
}
});
}
jdbc 调用存储过程
Class.forName(driver);
conn = DriverManager.getConnection(url, " root ", " ");
CallableStatement proc = null;
proc = conn.prepareCall("{ call proc_test(?) }");
proc.setString(1, "TestOne");
proc.execute();
proc.close();