我无法在我的java应用程序中调用oracle函数。 我有以下oracle函数:
FUNCTION GetClientAcc(
client_id in integer,
call_date in date default null
) RETURN ACC_TBL;
TYPE ACC_TBL IS REF CURSOR RETURN ACC_REC;
TYPE ACC_REC IS RECORD (
client_id NUMBER,
acc_id NUMBER,
acc_num VARCHAR2(25),
order_data CLOB
);
我尝试在java应用程序中调用它:
StoredFunctionCall functionCall = new StoredFunctionCall();
functionCall.setProcedureName("GetClientAcc");
functionCall.addNamedArgument("client_id");
functionCall.addNamedArgument("call_date");
functionCall.setResult("ACC_TBL");
ReadAllQuery query = new ReadAllQuery();
query.setReferenceClass(AccountInfo.class);
query.setCall(functionCall);
query.addArgument("client_id");
query.addArgument("call_date");
List<Object> args= new ArrayList<>();
args.add(10);
args.add(new Date());
JpaEntityManager jpaEntityManager = JpaHelper.getEntityManager(emNt);
Session session = jpaEntityManager.getActiveSession();
List<AccountInfo> result = (List<AccountInfo>)session.executeQuery(query, args);
我不明白为什么它不起作用。