-->
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.  [ 3 posts ] 
Author Message
 Post subject: hibernate mysql jsf internationalization
PostPosted: Mon Oct 27, 2008 10:36 pm 
Newbie

Joined: Sun Sep 28, 2008 1:18 pm
Posts: 4
Location: Pakistan
Hibernate version:3.2

DB Version: MYSQL 5

Problems with Arabic Encoding?

I am using JSF MYSQL and HIbernate but whenever i retrieve or save arabic data in/from database then it gives me junk record i.e ???????
i have entered a value forecefully into database with the بشبيسشتبيسشبسش
but still having the same issue when i try to retrieve this record.

Please help me out, any example will be appreciatable..

_________________
Wasif A Kirmani-Parisa


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 28, 2008 4:11 am 
Expert
Expert

Joined: Wed Mar 03, 2004 6:35 am
Posts: 1240
Location: Lund, Sweden
Have you specified that MySQL should use a character set that supports the characters that you want to use? Eg. utf-8? It can be done in several ways, for example when creating the database:

Code:
CREATE DATABASE `foo` DEFAULT CHARACTER SET utf8


It can also be specified per-table or per-column. Check the MySQL documentation for that.

You also need to set the correct options (in hibernate.properties/hibernate.cfg.xml or wherever you keep your configuration settings) in the connection URL to your database. For example:

Code:
jdbc:mysql://127.0.0.1/foo?characterEncoding=utf8


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 03, 2008 2:13 pm 
Newbie

Joined: Sun Sep 28, 2008 1:18 pm
Posts: 4
Location: Pakistan
Thanks for your reply..
i have also tried this one but not working..
Code:
<session-factory>




      <property name="connection.username">root</property>
      <property name="connection.url">jdbc:mysql://localhost:3307/kiosk_admin?characterEncoding=utf8</property>
      <property name="dialect">org.hibernate.dialect.MySQLInnoDBDialect</property>
      <property name="myeclipse.connection.profile">mysql</property>
      <property name="connection.driver_class">org.gjt.mm.mysql.Driver</property>
      <property name="hibernate.query.factory_class">
         org.hibernate.hql.classic.ClassicQueryTranslatorFactory
      </property>
      <property name="current_session_context_class">
         org.hibernate.context.JTASessionContext
      </property>
      <property name="transaction.factory_class">
         org.hibernate.transaction.JTATransactionFactory
      </property>
      <property name="transaction.manager_lookup_class">
         org.hibernate.transaction.SunONETransactionManagerLookup
      </property>
      <property name="show_sql">true</property>
      <property name="jdbc.batch_size">20</property>

      <property name="connection.autocommit">true</property>
[/code]

_________________
Wasif A Kirmani-Parisa


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

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.