Conversion from String to Locale not working when using Criteria API with Restriction

Description

I have following table:

That has following contents:

Table user_user

locale

en_US

fi_FI

sv_SE

I have following class:

which is mapped to that table as you can see. Fetching the contents of the table works fine:

The problems start when I want to have a freetext search that would search some arbitrary string from all fields of user entity:

As a side note, the above code works fine if you have Hibernate 3.5.6-Final.

Here's the full stack trace:

java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Locale
at org.hibernate.type.descriptor.java.LocaleTypeDescriptor.unwrap(LocaleTypeDescriptor.java:19)
at org.hibernate.type.descriptor.sql.VarcharTypeDescriptor$1.doBind(VarcharTypeDescriptor.java:46)
at org.hibernate.type.descriptor.sql.BasicBinder.bind(BasicBinder.java:73)
at org.hibernate.type.AbstractStandardBasicType.nullSafeSet(AbstractStandardBasicType.java:260)
at org.hibernate.type.AbstractStandardBasicType.nullSafeSet(AbstractStandardBasicType.java:255)
at org.hibernate.loader.Loader.bindPositionalParameters(Loader.java:2045)
at org.hibernate.loader.Loader.bindParameterValues(Loader.java:2014)
at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1944)
at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1897)
at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1875)
at org.hibernate.loader.Loader.doQuery(Loader.java:919)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:336)
at org.hibernate.loader.Loader.doList(Loader.java:2611)
at org.hibernate.loader.Loader.doList(Loader.java:2594)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2423)
at org.hibernate.loader.Loader.list(Loader.java:2418)
at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:109)
at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1705)
at org.hibernate.internal.CriteriaImpl.list(CriteriaImpl.java:363)

Environment

Windows 7

ds.driverClassName=org.hsqldb.jdbcDriver
ds.url=jdbc:hsqldb:mem:testdb
hibernate.dialect=org.hibernate.dialect.HSQLDialect
hibernate.hbm2ddl.auto=create-drop

Status

Assignee

Unassigned

Reporter

Jukka Hämäläinen

Fix versions

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure