我正在使用 JPA 调用 oracle 存储过程并得到下面提到的异常
错误
[4/24/14 9:07:37:583 EDT] 00000031 SystemOut O [EL Warning]: 2014-04-24 09:07:37.452--UnitOfWork(1697919964)--Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.4.0.v20120608-r11652): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'STP_REFRESH_CATEGORY_GUARANTEE'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
Error Code: 6550
Call: BEGIN STP_REFRESH_CATEGORY_GUARANTEE(SHIP_CODE=>?, SAIL_DATE=>?, return_code=>?); END;
bind => [3 parameters bound]
Query: DataReadQuery(name="refreshCategoryGuarantee" )
[4/24/14 9:07:37:584 EDT] 00000031 SystemOut O **********************************************************************************
[4/24/14 9:07:37:584 EDT] 00000031 SystemOut O EXCEPTION: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.4.0.v20120608-r11652): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'STP_REFRESH_CATEGORY_GUARANTEE'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
Error Code: 6550
Call: BEGIN STP_REFRESH_CATEGORY_GUARANTEE(SHIP_CODE=>?, SAIL_DATE=>?, return_code=>?); END;
bind => [3 parameters bound]
Query: DataReadQuery(name="refreshCategoryGuarantee" ) ship_code: AL sail_date: 01-JUN-14
代码 :
尝试{ 查询查询 = getEntityManager().createNamedQuery("refreshCategoryGuarantee"); query.setParameter("SHIP_CODE", ship_code); query.setParameter("SAIL_DATE", DateUtil.getSqlDate(sailDate)); return (Integer) query.getSingleResult(); }catch(异常前){ System.out.println("************************************************ ******************************************"); logger.error("使用参数执行 refreshCategoryGuarantee 命名查询时出错["+ship_code+","+sailDate+"] ", ex); 返回 StoredProcedureConstants.RETURN_CODE_EXCEPTION; }
Here, refreshCategoryGuarantee is named query of STP_REFRESH_CATEGORY_GUARANTEE procedures.
-------------
<pre>
@NamedStoredProcedureQuery(
name="refreshCategoryGuarantee",
procedureName="STP_REFRESH_CATEGORY_GUARANTEE",
returnsResultSet=false,
parameters={
@StoredProcedureParameter(queryParameter="SHIP_CODE", type=String.class),
@StoredProcedureParameter(queryParameter="SAIL_DATE", type=Date.class),
@StoredProcedureParameter(queryParameter="return_code", direction=Direction.OUT, type=Integer.class)
})
我的问题是,当我在 oracle 中执行下面提到的匿名块时,它的工作没有任何问题
设置服务器输出打开 宣布 rc 号码; 开始 STP_REFRESH_CATEGORY_GUARANTEE('OA','24-jan-15',rc); dbms_output.put_line('响应码:'||rc); 结尾;
我不知道为什么我在 JPA 电话中得到这个?你能请人帮我解决吗?