I have a simple web application where I use JPA.
I have an entity called BlogEntry.
When I submit a new BlogEntry, when I debug my applica
This solved it nicely:
<property name="hibernate.connection.useUnicode" value="true" />
<property name="hibernate.connection.characterEncoding" value="UTF-8" />
Edit: with hibernate 4.3.1 this works:
<property name="connection.useUnicode">true</property>
<property name="connection.characterEncoding">utf-8</property>
This helped in Spring Boot:
spring.datasource.url=jdbc:mysql://localhost:3306/securitydb?useUnicode=yes&characterEncoding=UTF-8
Another common mistake can be the wrong encoding of the database. If you just cerated the database without the correct encoding this error can also be a result. use
create database mydb character set utf8 collate utf8_general_ci;
instead of
create database mydb;
use the character encoding in the property of persistence.xml file
<property name="javax.persistence.jdbc.url"
value="jdbc:mysql://localhost:3306/blogdatabase?useUnicode=yes&characterEncoding=UTF-8"/>