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.
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.
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
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.