Hibernate 如何将游标作为IN参数传递给存储过程
我想将游标传递给存储过程,作为xyz.java文件中的IN参数。 我正在使用spring和hibernate。 你能帮我做这个吗。 急需,请尽快回复 如果你不能通过考试,你能帮我做些复习吗Hibernate 如何将游标作为IN参数传递给存储过程,hibernate,spring,stored-procedures,Hibernate,Spring,Stored Procedures,我想将游标传递给存储过程,作为xyz.java文件中的IN参数。 我正在使用spring和hibernate。 你能帮我做这个吗。 急需,请尽快回复 如果你不能通过考试,你能帮我做些复习吗 谢谢 使用Spring Stuff调用存储过程 enter code here : public class MyStoredProcedure extends StoredProcedure { public MyStoredProcedure(){ } public MyStoredProcedure(
谢谢 使用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);
}
}
在此处输入代码:公共类MyStoredProcess扩展StoredProcess{
公共MyStoreProcedure(){
}
公共MyStoredProcess(数据源ds){
这个.setDataSource(ds);
此.setSql(“程序名称”);
declareParameter(新的SqlParameter(“param”,Types.VARCHAR));
this.compile();
}
公共程序(){
Map inParams=new HashMap();
inParams.put(“param”、“Good”);
试一试{
执行(参数);
}捕获(例外e){
System.out.println(“错误人:+e”);
}
}
公共静态void main(字符串[]args){
DriverManager数据源新DriverManager数据源(“驱动程序”、“url”、“uname”、“upass”);
试一试{
MyStoredProcedure过程=新的MyStoredProcedure(数据源);
procedure.callProcedure();
}捕获(异常){
System.out.println(“Eroooorrror:+异常”);
}
}
}您使用的是什么数据库?您到底为什么要将光标传递给存储过程?您想做什么?