hibernate-jpa使用输出游标调用存储过程
发布时间:2022-04-22 02:33:08 247
相关标签: # php
我试图调用一个oracle存储过程,该过程返回一个输出游标usign JPA,如下所示
create or replace PROCEDURE stored_proc(ret_cursor OUT sys_refcursor, inputParam IN NUMBER)
-- body
END stored_proc;
@Entity
@NamedNativeQuery(name = "callStoredProc",
resultClass = Result.class,
query = "{call stored_proc(?,:inputParam)}",
callable = true,
readOnly=true
)
public class Result{
// map the result set params.
}
//JPA code to get result set
List resultList = getEntityManager().createNamedQuery("callStoredProc")
.setParameter("inputParam", inputParam)
.getResultList();
这一切都很好,但是,如果我试图更改过程定义,将游标更改为第二个参数,并在JPA代码中进行相应的参数更改,那么它就不起作用了。我明白了
[4/30/12 11:42:30:505 CDT]00000025系统错误由:java引起。sql。SQLException:ORA-06550:第1行第7列:PLS-00306:调用'stored_proc'时参数的数量或类型错误
create or replace PROCEDURE stored_proc(inputParam IN NUMBER,ret_cursor OUT sys_refcursor)
使用JPA时,输出游标是否应该始终是存储过程中的第一个参数?有解决办法吗?
特别声明:以上内容(图片及文字)均为互联网收集或者用户上传发布,本站仅提供信息存储服务!如有侵权或有涉及法律问题请联系我们。
举报