网上资料关于这个的好像不多,大多是JDBC的调用,而不是框架中调用
存储函数为
create or replace procedure hsz_count(
dt in number,dsum in out number )
is
begin
select count(*) into dsum from hsz_emp where deptno = dt;
end hsz_count;
以下是调用代码
String sql="{call hsz_count(?,?)}";
if(deptno == null||"".equals(deptno.trim())){
}else{
int dp = Integer.parseInt(deptno);
Integer rc = 0;
SQLQuery query=session.createSQLQuery(sql);
query.setInteger(1, dp);
query.setInteger(2, rc);
query.executeUpdate();
List list =query.list();
if(list.size()!= 0){
rc = (Integer) query.list().get(0);
this.page.setRecordCount(rc);
}
this.page.setList(list);
}
异常
java.lang.IllegalArgumentException: Positional parameter does not exist: 2 in query: {call hsz_count(?,?)}
第二个参数设置不对?求解.............
存储函数为
create or replace procedure hsz_count(
dt in number,dsum in out number )
is
begin
select count(*) into dsum from hsz_emp where deptno = dt;
end hsz_count;
以下是调用代码
String sql="{call hsz_count(?,?)}";
if(deptno == null||"".equals(deptno.trim())){
}else{
int dp = Integer.parseInt(deptno);
Integer rc = 0;
SQLQuery query=session.createSQLQuery(sql);
query.setInteger(1, dp);
query.setInteger(2, rc);
query.executeUpdate();
List list =query.list();
if(list.size()!= 0){
rc = (Integer) query.list().get(0);
this.page.setRecordCount(rc);
}
this.page.setList(list);
}
异常
java.lang.IllegalArgumentException: Positional parameter does not exist: 2 in query: {call hsz_count(?,?)}
第二个参数设置不对?求解.............