Problem retrieving Strings from varbinary columns using HIbernate and MySQL
Posted by: Florin H
Date: March 28, 2010 05:39AM

Hello,

Here's my scenario. I save a bunch of Strings containing asian characters in MySQL using Hibernate. These strings are written in varbinary columns. Everything works fine during the saving operation. The DB contains the correct values (sequence of bytes). If I query (again using Hibernate) for the Strings that I saved I get the correct results. But when Hibernate fills the entity to which the Strings belong with the values from the DB I get different values then the ones I used in the query that retrieved them. Instead of receiving the correct values I receive a bunch of FFFD replacement characters.

For example: if I store "하늘" in the DB and then I query for it, the resulting String will be \uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD.

* the DB connection has the following parameters set useUnicode=true&characterEncoding=UTF-8,
* I've tried using the following configurations for Hibernate but that didn't solve the problem:
- connection.useUnicode = true
- connection.characterEncoding = UTF-8

By the way, this works fine if the MySQL columns are of type varchar.
What am I missing? Any suggestions?
Thanks



Edited 2 time(s). Last edit at 03/28/2010 05:37AM by Florin H.

Options: ReplyQuote


Subject
Written By
Posted
Problem retrieving Strings from varbinary columns using HIbernate and MySQL
March 28, 2010 05:39AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.