我需要像List myList一样传递类列表。我试过了
在java中:
Query query = session.getNamedQuery("registerTest")
.setParameter("excList", myList);
System.out.println(" SUCCESS " +query.executeUpdate());
在oracle中:
CREATE OR REPLACE TYPE inc_list IS OBJECT (field1 int, field2 int);
CREATE OR REPLACE FUNCTION FUNC_MYFUNC(INC_LIST IN inc_list)
RETURN NUMBER
IS acc_bal NUMBER(11,2);
BEGIN
acc_bal:=1;
RETURN acc_bal;
END;
检查参数是否发送。但是给出错误
{call FUNC_MYFUNC(?)}
32559 [http-bio-9090-exec-10] WARN org.hibernate.util.JDBCExceptionReporter - SQL Error: 6550, SQLState: 65000
32559 [http-bio-9090-exec-10] ERROR org.hibernate.util.JDBCExceptionReporter - ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'FUNC_MYFUNC'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
Error inc exc : org.hibernate.exception.SQLGrammarException: could not execute native bulk manipulation query
org.hibernate.exception.SQLGrammarException: could not execute native bulk manipulation query
答案 0 :(得分:-1)
请尝试使用下一个电话:
Query query = session.getNamedQuery("registerTest")
.setParameterList("excList", myList);