H2 database not known to support REF_CURSOR parameters

881 Views Asked by At

I'm working on Oracle stored procedure, I have procedure and 1 parameter

in - > x IN VARCHAR2, out -> REF_CURSOR in out SYS_REFCURSOR. 

I'm trying to call this procedure using hibernate, but i have exception

I need the same but H2 database memory

But this error appears:

[org.hibernate.dialect.H2Dialect] not known to support REF_CURSOR parameters

This my code to create procedure:

DROP ALIAS IF EXISTS LOGPROCESSOR;
CREATE ALIAS LOGPROCESSOR AS $$
@CODE
java.sql.ResultSet getTableContent(java.sql.Connection con, final String cv_1) throws Exception {
    String resultValue=null;
    java.sql.ResultSet rs = con.createStatement().executeQuery(
    "SELECT IDTLOG,DATE,IDSTORE,INIUPLOAD,RECEIVED,PENDING,VALIDATED FROM LOGPROCESSOR_GETSTATUSREPORT");
       /*while(rs.next())
       {
        resultValue=rs.getString(1);
       }
    return resultValue;*/
    return rs;
}
1

There are 1 best solutions below

0
On

Unfortunately the Hibernate H2Dialect does not yet support stored procedures with REF_CURSOR result sets, so it isn't possible at this time.

The H2Dialect extends the base Dialect class but does not implement the getCallableStatement method

public CallableStatementSupport getCallableStatementSupport() {
    // most databases do not support returning cursors (ref_cursor)...
    return StandardCallableStatementSupport.NO_REF_CURSOR_INSTANCE;
}