Org.hibernate.dialect.Oracle10gDialect does not support a result set via stored procedures

I am trying to call a database stored procedure (Oracle 10g) with JPA 2.1 (Hibernate 4.3.5). The procedure returns the results in the output cursor:

PROCEDURE GET_EMPLOYEE( P_ID_EMP IN VARCHAR2, P_CURSOR OUT TYPES.cursor_type ) AS ... 

Java Code:

 @NamedStoredProcedureQuery(name = "Employee.findById", resultClasses = Employee.class, procedureName = "GET_EMPLOYEE", parameters = { @StoredProcedureParameter(mode = ParameterMode.IN, name = "P_ID_EMP", type = String.class), @StoredProcedureParameter(mode = ParameterMode.REF_CURSOR, name = "P_CURSOR", type = void.class) } ) 

Call:

 StoredProcedureQuery query = em.createNamedStoredProcedureQuery("Employee.findById"); query.setParameter("P_ID_EMP", "ID00001"); List<Employee> employees = query.getResultList(); //exception launched here 

This exception is thrown:

 Exception in thread "main" java.lang.UnsupportedOperationException: org.hibernate.dialect.Oracle10gDialect does not support resultsets via stored procedures at org.hibernate.dialect.Dialect.registerResultSetOutParameter(Dialect.java:1612) at org.hibernate.engine.jdbc.cursor.internal.StandardRefCursorSupport.registerRefCursorParameter(StandardRefCursorSupport.java:94) at org.hibernate.procedure.internal.AbstractParameterRegistrationImpl.prepare(AbstractParameterRegistrationImpl.java:298) at org.hibernate.procedure.internal.ProcedureCallImpl.buildOutputs(ProcedureCallImpl.java:417) at org.hibernate.procedure.internal.ProcedureCallImpl.getOutputs(ProcedureCallImpl.java:378) at org.hibernate.jpa.internal.StoredProcedureQueryImpl.outputs(StoredProcedureQueryImpl.java:251) at org.hibernate.jpa.internal.StoredProcedureQueryImpl.getResultList(StoredProcedureQueryImpl.java:334) 

The same code works fine with Eclipselink 2.5.1 (but cannot use it).

I know that I can get a JDBC connection from entitymanager and use the classic Resultset material to get the results, but I would like to use JPA 2.1 - Hibernate.

Thanks.

+7
hibernate jpa cursor
source share

No one has answered this question yet.

See related questions:

118
SQL Call Stored procedure for each row without using a cursor
one
java.lang.UnsupportedOperationException: org.hibernate.dialect.HSQLDialect does not support results using stored procedures
one
Hibernate JPA inheritance and stored procedure returning multiple result sets
0
db2 can you change the cursor result set in the same stored procedure?
0
jpa call stored procedure with output cursor
0
Mysql ResultsetMapping for stored procedure
0
Call a stored procedure using Hibernate
0
stored procedure returning a calculated result set
0
Stored procedure does not return a result set
0
java.lang.UnsupportedOperationException: org.hibernate.dialect.Oracle10gDialect does not support results using stored procedures

All Articles