我有一个 spring 数据存储库,它调用一个使用命名查询定义的过程。存储过程有两个参数,第一个是 ref_cursor,第二个是参数。这是 sp 签名:
create or replace procedure proc1(out_pos out sys_refcursor , pTrans_ID in Number) is ............
这也是实体上的命名查询定义:
@javax.persistence.NamedStoredProcedureQuery(name = "getProc", procedureName = "proc1",
parameters ={
@StoredProcedureParameter(name = "out_pos",mode = ParameterMode.REF_CURSOR,type = void.class),
@StoredProcedureParameter(name = "pTrans_ID",mode = ParameterMode.IN,type = Long.class)
}
)
这是调用命名查询的存储库:
public interface TempReportRepository extends SwiftRepository<TempReportEntity,Long> {
@Procedure(name = "getProc")
public Object[] getProc1(@Param("pTrans_ID") Long inParam1);
}
当我getProc1
在下面调用异常引发时:
Caused by: java.sql.SQLException: operation not allowed: Ordinal binding and Named binding cannot be combined!
at oracle.jdbc.driver.OracleCallableStatement.execute(OracleCallableStatement.java:10093)
at oracle.jdbc.driver.OraclePreparedStatementWrapper.execute(OraclePreparedStatementWrapper.java:5693)
at org.hibernate.result.internal.OutputsImpl.<init>(OutputsImpl.java:69)
... 72 more