Adding Unicode character to mysql from Java-hibernate

How to enable/add unicode character in hibernate with mysql

Unicode is ruling, it would come handy when working with non ASCII characters like when dealing with Chinese or Ethiopian alphabet amharic characters.

With internalization being the main concern in softwares, bit it website or mobile application, there is a chance you will need unicode in your application.

Hibernate is an ORM, object relational mapper, that is being used with Java and .net. It will allow to abstract all the database related stuffs with simple interface. In this unicode hibernate tutorial, I will show how you can insert, select update and delete records with unicode.

Why do I get No provider for Entity manager Error and how should I fix it

I will show the fix from the hibernate side for MySQL. But keep in mind that unicode characters have to be enabled on the database side as well with proper encoding.

See how you can avoid could not open hibernate session error

The solution for having unicode characters to be recognized as they are passing though the hibernate world would be done on the config file.

Enabling unicode character in hibernate

Here are the steps to follow:

1. go to your hibernate.cfg.xml file

2. make your the connection url something like: jdbc:mysql://localhost:3306/database?useUnicode=true&characterEncoding=UTF-8 – make sure the the ampersand is the html-encoded ampersand.

Do you know you can have boilerplate java app with maven?

Find k complementary numbers – algorithm in Java

Add scrollbar to mysql result in terminal

mysql command not found on mac after installation

Upgrade mysql version from 5.5 to 5.6

Configuring PHP + MySQL + Apache on Amazon EC2 Step by Step

Access MySQL from Host being on Vagrant

Setting new Vagrant machine for PHP-Mysql development

2 Comments
  1. abhinavchandel

    Hi,

    when i set this and got some error like “Incorrect string value: ‘xE0xA4x87xE0xA4xB8…’ for column “

    1. gullele

      can you provide the whole error please?

Leave a Reply

Your email address will not be published. Required fields are marked *

*
*