Passing char[] or byte[] to equal function of CriteriaBuilder throws java.lang.ClassCastException (Vyacheslav Dimitrov)

Description

We have byte[] field in one of our entity and we want to make query like this.

But this code throws exception:

[java] Exception in thread "main" java.lang.ClassCastException: [B cannot be cast to [Ljava.lang.Object;
[java] at org.hibernate.ejb.AbstractQueryImpl.registerParameterBinding(AbstractQueryImpl.java:349)
[java] at org.hibernate.ejb.QueryImpl.setParameter(QueryImpl.java:364)
[java] at org.hibernate.ejb.criteria.CriteriaQueryCompiler$1$1.bind(CriteriaQueryCompiler.java:194)
[java] at org.hibernate.ejb.criteria.CriteriaQueryCompiler.compile(CriteriaQueryCompiler.java:247)
[java] at org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:441)
[java] at ru.petrsu.nest.oqlite.test.TestParser.main(TestParser.java:92)
[java] Java Result: 1

because class AbstractQueryImpl has code:

We offer to change this "if" like this

Due to this new condition we get what we want and our criteria works fine. (At least ClassCastExceptio isn't occured).

Patch is attached (Also I can do pull request, if needed).

Environment

Hibernate 3.6.0-Finale, derby db, mysql db, hsqldb

Assignee

Gail Badner

Reporter

Vyacheslav Dimitrov

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Minor
Configure