-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Collation selection in HQL?
PostPosted: Fri Mar 28, 2008 8:28 am 
Newbie

Joined: Fri Mar 28, 2008 7:28 am
Posts: 1
Hi

I have a problem with the sorting of data in my database. We have several different customers in several different countries and each of these countries have different sorting. The following specs on the system:

Hibernate: 3.2.0.GA
Application server: Jboss 4.0.5.GA (EJB3)
Runtime: Java 1.5
Database: MySQL 5.0.45
Operationsystem: Linux

What I would like to accomplish is a way of making it possible to set the type of collation I want to use in a specific search. To test this I constructed the following HQL query:

SELECT object(o) FROM UserEntity o INNER JOIN o.person.vehicleUser.statuses s WHERE s.division.id in (:ids) ORDER BY o.person.familyName COLLATE utf8_swedish_ci

Where I later planned to replace utf8_swedich_ci with :collate and using the query.setParameter method to state what collation I wich to use (depending on who is doing the search).

Unfortionally hibernates HQL can't recognize the COLLATE statement.

org.hibernate.hql.ast.QuerySyntaxException: unexpected token: COLLATE near line 1, column 180 [select object(o) from se.pilotfish.fairfleet.user.domain.entity.UserEntity o INNER JOIN o.person.vehicleUser.statuses s WHERE s.division.id in (:ids) order by o.person.familyName COLLATE utf8_swedish_ci]
at org.hibernate.hql.ast.QuerySyntaxException.convert(QuerySyntaxException.java:31)
at org.hibernate.hql.ast.QuerySyntaxException.convert(QuerySyntaxException.java:24)
at org.hibernate.hql.ast.ErrorCounter.throwQueryException(ErrorCounter.java:59)
at org.hibernate.hql.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:258


Is there any other way of accomplishing this?

Regards
Martin


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.