-->
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.  [ 3 posts ] 
Author Message
 Post subject: Problem with German Umlaute in Query
PostPosted: Mon Aug 29, 2005 7:41 am 
Newbie

Joined: Sat May 01, 2004 2:48 pm
Posts: 13
Location: Sweden
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:
v.3.0

Name and version of the database you are using:
Postgres 8.0, latest JDBC Driver


I try to execute the following statement:
select * from Kontakt where userid='grüber';
(Notice the German Umlaut "ü" in the statement, it is the problem)

The following exception is thrown:
13:33:45,609 DEBUG QueryTranslatorImpl:206 - parse() - HQL: from at.administration.hibernate.mappedClasses.Kontakt where userid='grüber')
13:33:45,625 ERROR PersonDisplayAction:84 - Hibernate Exception:
org.hibernate.QueryException: expecting ''', found 'ü' [from at.administration.hibernate.mappedClasses.Kontakt where userid='grüber')]
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:165)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:83)
at org.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:414)
at org.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:814)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:773)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:74)
[....]

The root cause seems to be expecting ''', found 'ü'. Is there an option I missed so that hibernate can deal with German Umlaute in the statements? When I directly execute the statement in the postgres database, it works.

Thanks in advance!

Regards,
Markus


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 29, 2005 8:14 am 
Expert
Expert

Joined: Thu Dec 04, 2003 12:36 pm
Posts: 275
Location: Bielefeld, Germany
Try this:
Code:
Query query = session.createQuery("select k from Kontakt as k where k.userid = :userid");
query.setString("userid", "grüber");
List result = query.list();


Best regards
Sven

_________________
Please don't forget to give credit, if this posting helped to solve your problem.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 29, 2005 9:59 am 
Newbie

Joined: Sat May 01, 2004 2:48 pm
Posts: 13
Location: Sweden
Actually, updating to the latest hibernate version 3.1 beta2 helped. I read the changelog and saw:

[HHH-734] - HQL incorrectly parses certain query strings

I assume that relates to my problem.

Anyway, thanks!
Markus


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

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.