-->
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: Hibernate with MySQL encoding problem
PostPosted: Sat Sep 08, 2012 10:07 am 
Newbie

Joined: Sat Sep 08, 2012 9:58 am
Posts: 5
Hello.

I have a MySQL server with character encoding set to latin2.
In my hibernate.cfg.xml I have:
Quote:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="connection.url">
jdbc:mysql://localhost/WebAppDB?useUnicode=true&amp;characterEncoding=latin2&amp;connectionCollation=latin2_general_ci&amp;characterSetResults=latin2

</property>
<property name="hibernate.connection.characterEncoding" value="latin2" />
<property name="hibernate.connection.charSet" value="latin2" />
<property name="hibernate.connection.username">root</property>
<property name="hibernate.show_sql">true</property>
<property name="hibernate.current_session_context_class">thread</property>
<property name="hibernate.query.factory_class">org.hibernate.hql.classic.ClassicQueryTranslatorFactory</property>
<mapping resource="dbTables/Czlowiek.hbm.xml"/>
</session-factory>
</hibernate-configuration>


I am not an advance Hibernate user and I was testing my connection with HQL Query. I want to get polish characters and instead of them I got characters like '^' or 'รค'. When i retrive data from mysql command line everything works perfect, so I think there's a problem in my netbeans/hibernate configuration. Any ideas what to change?

best regards !


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.