I am attempting to migrate from Hibernate 2.1 to 3.1. I installed Hibernate 3.1.0_beta4. MySQL is the underlying DB implementation. Hibernate 3.1 is having trouble with a couple of named queries that do work with the older 2.1 version. The trouble occurs when using BINARY as a where clause qualifier. I prefix BINARY in a search to impose case sensitive string search ( re. mysql manual: string comparison ).
My named query looks something like this in the .hbm.xml file:
This worked just as I wished in 2.1, but with 3.1, I get the following runtime exception while attempting Configuration.rebuildSessionFactory():
com.acme.hibernate.InfrastructureException: org.hibernate.HibernateException: Errors in named queries: com.acme.myclass.caseSensitiveSearch
There is no specific information provided to direct me to the cause of the error. However, the exception is not thrown if I remove the BINARY qualifier from the where statement.
Has anyone else seen or heard of this?
thanks. ------------------------------------------------------------------- I found the following in a Hibernate 3 Migration notes doc:
Query Language Changes Hibernate3 comes with a brand-new, ANTLR-based HQL/SQL query translator. However, the Hibernate 2.1 query parser is still available. The query parser may be selected by setting the Hibernate property hibernate.query.factory_class. The possible values are org.hibernate.hql.ast.ASTQueryTranslatorFactory, for the new query parser, and org.hibernate.hql.classic.ClassicQueryTranslatorFactory, for the old parser. We are working hard to make the new query parser support all queries allowed by Hibernate 2.1. However, we expect that many existing applications will need to use the Hibernate 2.1 parser during the migration phase.
[ March 02, 2006: Message edited by: Bridget Kennedy ]
subject: trouble using BINARY in where clause with Hibernate 3.1