Cannot get UTF-8 Strings from MySQL DB
--------------------------------------
Key: HHH-3443
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-3443
Project: Hibernate3
Issue Type: Bug
Affects Versions: 3.2.6
Environment: MySQL 5, JRE 1.6
Reporter: Chris Welz
Hi,
I've tried now for 2 days to get my Hibernate Application reading UTF-8 Strings from
the Database with no success.
I created my Database with the following SQL Script:
CREATE TABLE IF NOT EXISTS `t_gvz_type_name` (
`ID_GVZ_Type_Name_intern` int(11) NOT NULL,
`Type_GVZ` int(11) default NULL COMMENT 'Typ der Gebietskörperschaft',
`Name_GVZ_Type` varchar(50) default NULL COMMENT 'Name des Types der
Gebietskörperschaft',
`LanguageID` int(11) default NULL,
PRIMARY KEY (`ID_GVZ_Type_Name_intern`),
KEY `FK_GVZ_Type_Name_Language` (`LanguageID`),
KEY `FK_GVZ_Type_Name` (`Type_GVZ`)
) ENGINE=InnoDB DEFAULT CHARACTER SET utf8 COMMENT='Name des
Gebietskörperschaftstypes';
My hibernate.cfg.xml:
<property
name="hibernate.bytecode.use_reflection_optimizer">false</property>
<property
name="hibernate.connection.driver_class">org.gjt.mm.mysql.Driver</property>
<property
name="hibernate.connection.password">christian</property>
<property
name="hibernate.connection.url">jdbc:mysql://localhost:3306/vzf_net?useUnicode=true&characterEncoding=utf8</property>
<property
name="hibernate.connection.username">root</property>
<property
name="hibernate.current_session_context_class">org.hibernate.context.ThreadLocalSessionContext</property>
<property
name="hibernate.dialect">org.hibernate.dialect.MySQL5InnoDBDialect</property>
This is, how I try to get the values from DB:
List result = session.createQuery("from TGvzTypeName where
TGzvType="+TypeGvz).list();
What do I have to do to get the Strings in UTF-8 ?
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira