[hibernate-dev] envers + classic QueryTranslator failing test

andrea boriero andrea at hibernate.org
Thu Sep 17 07:08:02 EDT 2015


I'm working on https://hibernate.atlassian.net/browse/HHH-9996
and I stumbled across the following test:

org.hibernate.envers.test.integration.basic.ClassicQueryTranslatorFactoryTest

I run the test not only with Derby but also with PostgreSQL and the test
fails for both.

The query:
select e__ from org.hibernate.envers.test.entities.IntTestEntity_AUD e__
where e__.originalId.REV.id = (select max(e2__.originalId.REV.id) from
org.hibernate.envers.test.entities.IntTestEntity_AUD e2__ where e2__.
originalId.REV.id <= :revision and e__.originalId.id = e2__.originalId.id)
and e__.REVTYPE <> :_p0 and e__.originalId.id = :_p1

causes the error java.sql.SQLException: An attempt was made to put a data
value of type 'byte[]' into a data value of type 'SMALLINT'. in Derby

while in PostgreSQL the error is org.postgresql.util.PSQLException: ERROR:
operator does not exist: smallint <> bytea   Hint: No operator matches the
given name and argument type(s).

The problem is related with
org.hibernate.hql.internal.classic.QueryTranslatorImpl$ParameterTranslations#getNamedParameterExpectedType(String
name)  returning null for the _p0 parameter (while the correct return type
should be ReivsionTyptType) this cause the wrong sql bind..

Any help is more than welcome?

Thanks

Andrea


More information about the hibernate-dev mailing list