Unable to resolve Oracle CURSOR JDBC type code: org.hibernate.HibernateException: Unable to access OracleTypes.CURSOR value in EAP

Solution Verified - Updated -

Issue

  • Using @DataSourceDefinition to define an unmanaged datasource
  • Calling an Oracle stored procedure with an OUT parameter of type SYS_REFCURSOR such as the below

    CREATE OR REPLACE PROCEDURE my_proc ( STRING_PARAM IN VARCHAR2, CURSOR_PARAM OUT SYS_REFCURSOR ) AS
    BEGIN
        OPEN CURSOR_PARAM FOR SELECT 1,2,3 FROM DUAL; -- simulate a real return
    END my_proc;
    
  • Encountering java.lang.ClassNotFoundException: oracle.jdbc.OracleTypes when executing a stored procedure query

    ... WARN  [org.hibernate.dialect.OracleTypesHelper] ... Unable to resolve Oracle CURSOR JDBC type code: org.hibernate.HibernateException: Unable to access OracleTypes.CURSOR value
    ...
    Caused by: org.hibernate.HibernateException: Unable to locate OracleTypes class using either known FQN [oracle.jdbc.OracleTypes, oracle.jdbc.driver.OracleTypes]
    ...
    Caused by: java.lang.ClassNotFoundException: oracle.jdbc.OracleTypes from [Module "org.hibernate:main" from local module loader ...]
    ...
    ... DEBUG [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] ... Error asking dialect to register ref cursor parameter ...: java.sql.SQLException: Invalid column type: -99    
    

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP) 7
  • Hibernate 5

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content