GeeCON Prague 2014*
The moose likes Object Relational Mapping and the fly likes test™ (test with TradeMark symbol) inserting as 'test?' withHibernate and MySQL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "test™ (test with TradeMark symbol) inserting as Watch "test™ (test with TradeMark symbol) inserting as New topic
Author

test™ (test with TradeMark symbol) inserting as 'test?' withHibernate and MySQL

Jaggit singh
Greenhorn

Joined: Jan 14, 2010
Posts: 3
Hi,

I am using Hibernate with MySQL. I have an object that holds field value test™ (test with TradeMark symbol), when I am trying to insert this object through saveorUpdate method, it is inserting value in the table as ‘test?’

It is correctly working with simple jdbc call.

Please suggest me the proper steps for the above problem in Hibernate or is it a bug?
nimo frey
Ranch Hand

Joined: Jun 28, 2008
Posts: 580
hello,

either, use ascii for TM:

returns ™

or

returns ™

or check your database settings of MySQL (maybe set to UTF-8)..

Jaggit singh
Greenhorn

Joined: Jan 14, 2010
Posts: 3
Still I am not able to identify the problem. Here is my hibernate configuration

<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.MySQLDialect
</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.format_sql">true</prop> <prop key="hibernate.jdbc.use_getGeneratedKeys">
true
</prop>
<prop key="hibernate.cache.use_query_cache">
false
</prop>
<prop key="hibernate.cache.use_second_level_cache">false</prop>
<prop key="hibernate.query.factory_class">
org.hibernate.hql.classic.ClassicQueryTranslatorFactory
</prop>
<prop key="hibernate.connection.useUnicode">true</prop>
<prop key="hibernate.connection.characterEncoding">UTF-8</prop>
</props>
</property>

Please suggest the clearcut solution !!!
Jaggit singh
Greenhorn

Joined: Jan 14, 2010
Posts: 3
Help expecting!!!
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42032
    
  64
Please keep the number of exclamation marks in your posts to the required minimum, possibly avoiding them completely.

Is the DB schema set to use Unicode?


Ping & DNS - my free Android networking tools app
 
GeeCON Prague 2014
 
subject: test™ (test with TradeMark symbol) inserting as 'test?' withHibernate and MySQL