如何使用休眠和 java 传递列表参数预言机过程



我需要像 List myList 这样的类列表。我试过了

在爪哇中:

Query query = session.getNamedQuery("registerTest")
                    .setParameter("excList", myList);
            System.out.println(" SUCCESS " +query.executeUpdate());

在甲骨文中:

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

请尝试使用下一个调用:

Query query = session.getNamedQuery("registerTest")
                    .setParameterList("excList", myList);

最新更新