【发布时间】:2010-07-14 12:03:18
【问题描述】:
我想将游标作为 xyz.java 文件中的 IN 参数传递给存储过程。 我正在使用弹簧和休眠。 你能帮我解决这个问题吗? 急需。尽快回复。
如果不能通过,那么你能帮忙解决一些问题吗?
谢谢。
【问题讨论】:
-
您使用的是什么数据库,为什么要将游标传递给存储过程,您要做什么?
标签: hibernate spring stored-procedures
我想将游标作为 xyz.java 文件中的 IN 参数传递给存储过程。 我正在使用弹簧和休眠。 你能帮我解决这个问题吗? 急需。尽快回复。
如果不能通过,那么你能帮忙解决一些问题吗?
谢谢。
【问题讨论】:
标签: hibernate spring stored-procedures
使用 Spring Stuff 调用存储过程..
enter code here : public class MyStoredProcedure extends StoredProcedure {
public MyStoredProcedure(){
}
public MyStoredProcedure(DataSource ds) {
this.setDataSource(ds);
this.setSql("procedure name");
this.declareParameter(new SqlParameter("param", Types.VARCHAR));
this.compile();
}
public void callProcedure() {
Map<String, String> inParams = new HashMap<String, String>();
inParams.put("param", "Good");
try {
execute(inParams);
} catch (Exception e) {
System.out.println("Error Man : " + e);
}
}
public static void main(String[] args) {
DriverManagerDataSource dataSource new DriverManagerDataSource("Driver", "url", "uname", "upass");
try{
MyStoredProcedure procedure = new MyStoredProcedure(dataSource);
procedure.callProcedure();
}catch(Exception exception){
System.out.println("Eroooorrror : "+exception);
}
}
}
【讨论】: