This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

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

 
Jaggit singh
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 580
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello,

either, use ascii for TM:

returns ™

or

returns ™

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

 
Jaggit singh
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Help expecting!!!
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!