How to call Oracle Function or Procedure using Hibernate (EntityManager) or JPA

前端 未结 6 934
小蘑菇
小蘑菇 2020-11-28 09:36

I have an Oracle function which return sys-refcursor and when I call this function using Hibernate, I am getting the following exception.

Hibernate: { ? = ca         


        
6条回答
  •  清歌不尽
    2020-11-28 09:56

    You seem to be confusing Oracle functions with Oracle stored procedures.

    Functions can be invoked from a select statement - user defined functions like yours act the same way as the built-in functions, like min() and max(). They cannot be invoked by an external "call" like stored procedures can.

    See http://docs.oracle.com/cd/B19306_01/server.102/b14200/functions231.htm#i1012049 for the definition of a function.

    You probably will need to re-write your function as a stored procedure.

提交回复
热议问题