title: Caused by: org.hibernate.exception.GenericJDBCException: Error asking dialect to register ref cursor parameter [5]
body: <p>When I execute the code below, I get the following error on line spq.execute(). Could you give me some tip about whats wrong, please?</p>
  
  <pre><code>StoredProcedureQuery spq = emOracle.createStoredProcedureQuery("SDBANCO.PRC_CNS_SLD_JUD_BLOQ_DESBLOQ");
      spq.registerStoredProcedureParameter(1, BigDecimal.class, ParameterMode.IN);
      spq.registerStoredProcedureParameter(2, BigDecimal.class, ParameterMode.IN);
      spq.registerStoredProcedureParameter(3, BigDecimal.class, ParameterMode.IN);
      spq.registerStoredProcedureParameter(4, String.class, ParameterMode.IN);
      spq.registerStoredProcedureParameter(5, Class.class, ParameterMode.REF_CURSOR);
  
      // set input parameter
      spq.setParameter(1, BigDecimal.valueOf(Long.parseLong(agencia)));
      spq.setParameter(2, BigDecimal.valueOf(Long.parseLong(conta)));
      spq.setParameter(3, BigDecimal.valueOf(Long.parseLong(codigoBloqueioLegado)));
      spq.setParameter(4, cpfCnpj);
  
      BloqueioJudicial bloqueioJudicial = null;
      try{
          if (spq.execute()) {
              bloqueioJudicial = (BloqueioJudicial) spq.getSingleResult();
              return bloqueioJudicial.getSaldoBloqueado();
          }
      } catch (NoResultException nre) {
          return new BigDecimal(0);
      }
  
      return new BigDecimal(0);
  </code></pre>
  
  <p>Error:</p>
  
  <blockquote>
    <p>Caused by: org.hibernate.exception.GenericJDBCException: Error asking dialect to register ref cursor parameter [5]
        at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:47)
        at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:109)
        at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:95)
        at org.hibernate.engine.jdbc.cursor.internal.StandardRefCursorSupport.registerRefCursorParameter(StandardRefCursorSupport.java:60)
        at org.hibernate.procedure.internal.AbstractParameterRegistrationImpl.prepare(AbstractParameterRegistrationImpl.java:347)
        at org.hibernate.procedure.internal.ProcedureCallImpl.buildOutputs(ProcedureCallImpl.java:402)
        at org.hibernate.procedure.internal.ProcedureCallImpl.getOutputs(ProcedureCallImpl.java:363)
        at org.hibernate.jpa.internal.StoredProcedureQueryImpl.outputs(StoredProcedureQueryImpl.java:234)
        at org.hibernate.jpa.internal.StoredProcedureQueryImpl.execute(StoredProcedureQueryImpl.java:217)
        at br.com.company.juridico.repository.impl.CartNetRepositoryImpl.consultarSaldoBloqueadoContaProduto(CartNetRepositoryImpl.java:155)
        at br.com.company.juridico.repository.impl.CartNetRepositoryImpl$$FastClassBySpringCGLIB$$60a23375.invoke()
        at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
        at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:721)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
        at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:136)
        ... 98 more
    Caused by: java.sql.SQLException: Invalid column type: -99
        at oracle.jdbc.driver.OracleStatement.getInternalType(OracleStatement.java:4188)
        at oracle.jdbc.driver.OracleCallableStatement.registerOutParameterInternal(OracleCallableStatement.java:129)
        at oracle.jdbc.driver.OracleCallableStatement.registerOutParameter(OracleCallableStatement.java:326)
        at oracle.jdbc.driver.OracleCallableStatement.registerOutParameter(OracleCallableStatement.java:574)
        at oracle.jdbc.driver.OracleCallableStatementWrapper.registerOutParameter(OracleCallableStatementWrapper.java:1585)
        at org.jboss.jca.adapters.jdbc.CachedCallableStatement.registerOutParameter(CachedCallableStatement.java:153)
        at org.jboss.jca.adapters.jdbc.WrappedCallableStatement.registerOutParameter(WrappedCallableStatement.java:1168)
        at org.hibernate.dialect.Oracle8iDialect.registerResultSetOutParameter(Oracle8iDialect.java:552)
        at org.hibernate.engine.jdbc.cursor.internal.StandardRefCursorSupport.registerRefCursorParameter(StandardRefCursorSupport.java:57)
        ... 109 more</p>
  </blockquote>