-->
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: encoding problem with special characters
PostPosted: Thu Jul 28, 2005 7:44 am 
Newbie

Joined: Wed Jul 27, 2005 5:01 pm
Posts: 3
Hi Hibernate users,

I'm new to Hibernate. I use it in the persistance layer of a little webapp.

I have a problem with queries that have special characters (é,à,...) in the 'where' clause. I imagine it's an encoding problem.

For example, if I write and log the following hibernate query:

Quote:
from MyClass where myfield like '%algèbre%'


Then, when I put show_sql to true, I get the following query in the logs:

Quote:
select ...sql blablabla... where myfield like '%algèbre%'


I don't understand why Hibernate don't reproduce the same characters in the sql query. Where could I tell Hibernate what encoding to use? Is the previous question weak?

Thank you for your help.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 28, 2005 8:53 am 
Newbie

Joined: Wed Jul 27, 2005 5:01 pm
Posts: 3
argh, it works on windows. I think I have a problem with encoding on my linux platform. The problem is not only related to hibernate.


Top
 Profile  
 
 Post subject: encoding problem with special characters [solved]
PostPosted: Thu Aug 04, 2005 9:18 am 
Newbie

Joined: Wed Jul 27, 2005 5:01 pm
Posts: 3
After having debugged until antlr processing, I exposed my problem on another forum.Someone gave me a clue: 'Are the special characters in the parameters of your HQL request?'. Well, parameter? Oh my god, I don't use setParameter(), setDate(), etc. The 'where" clauses were written like SQL.

Then I re-wrote my 'where' clause constructor using hibernate API methods, and now it works.


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.