2 Replies Latest reply on Aug 6, 2009 11:55 AM by suchong

    Oracle 932 Error with AuditQuery.forRevisionsOfEntity

      Hi there,

      I have a problem on Oracle 10g with the AuditQuery.forRevisionsOfEntity();

      If I set the param selectDeletedEntities to false, then an error on Oracle occurs.

      AuditQuery query = reader.createQuery().forRevisionsOfEntity(Contract.class, true, false);


      I get the following error:

      Hibernate: select contract_a0_.ID as ID11_, contract_a0_.REV as REV11_, contract_a0_.REVTYPE as REVTYPE11_, contract_a0_.AANTAL_PLAATSEN as AANTAL4_11_, contract_a0_.MUTATIE_STATUS as MUTATIE5_11_, contract_a0_.OVERDRACHT_CPT_BEHEER as OVERDRACHT6_11_, contract_a0_.DATUM_AANVANG as DATUM7_11_, contract_a0_.DATUM_EINDE as DATUM8_11_, contract_a0_.SOORT as SOORT11_ from CPT_CONTRACTEN_AUD contract_a0_ where (contract_a0_.REVTYPE<>? ) order by contract_a0_.REV asc
       [WARN] org.hibernate.util.JDBCExceptionReporter - [SQL Error: 932, SQLState: 42000]
       [ERROR] org.hibernate.util.JDBCExceptionReporter - [ORA-00932: inconsistent datatypes: expected NUMBER got BINARY
      


      It has something to do with the param: contract_a0_.REVTYPE<>?

      My configuration:

      [INFO] org.hibernate.cfg.annotations.Version - [Hibernate Annotations 3.4.0.GA]
      [INFO] org.hibernate.cfg.Environment - [Hibernate 3.3.2.GA]
      [INFO] org.hibernate.cfg.Environment - [hibernate.properties not found]
      [INFO] org.hibernate.cfg.Environment - [Bytecode provider name : javassist]
      [INFO] org.hibernate.cfg.Environment - [using JDK 1.4 java.sql.Timestamp handling]
      [INFO] org.hibernate.annotations.common.Version - [Hibernate Commons Annotations 3.1.0.GA]
      [INFO] org.hibernate.ejb.Version - [Hibernate EntityManager 3.4.0.GA]
      [INFO] org.hibernate.cfg.SettingsFactory - [RDBMS: Oracle, version: Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Production
      With the Partitioning, OLAP and Data Mining options]
      [INFO] org.hibernate.cfg.SettingsFactory - [JDBC driver: Oracle JDBC driver, version: 10.2.0.1.0]


      I am using Envers 1.2.1.GA

        • 1. Re: Oracle 932 Error with AuditQuery.forRevisionsOfEntity
          adamw

          No idea, sorry. I don't have an Oracle DB to test ;)

          Adam

          • 2. Re: Oracle 932 Error with AuditQuery.forRevisionsOfEntity

            Hey Adam,

            I've got exactly the same problem:
            Oracle 10 g
            Hibernate 3.3.2
            Enverse 1.2.1

            Here is the query it wants to execute, with the following parameters {_p2=1, _p1=DEL, _p0=1}:
            select e
            from nl.test.TestCase_AUD e
            where e.REVTYPE <> :_p1
            and e.originalId.REV.id = (
            select max(e2.originalId.REV.id)
            from nl.test.TestCase_AUD e2
            where e2.originalId.REV.id <= :_p0
            and e.originalId.id = e2.originalId.id)
            and e.originalId.id = :_p2

            I think _p1 should be the value of the enum type org.hibernate.envers.RevisionType instead of DEL. this might be the cause of the following error:
            Caused by: java.sql.SQLException: ORA-00932: inconsistent datatypes: expected NUMBER got BINARY

            Any idea??....