Im developing a Jee webapp using JPA/Hibernate as ORM framework, PostgreSQL as db, and Tomcat as server. When i start the app i want entitymanager to inject some data in my db. I do that whith
<property name="javax.persistence.sql-load-script-source" value="META-INF/data.sql"/>
in persistence.xml Everything works fine except that i get some bad encoding like "Ardèche" instead of "Ardèche".
My whole project is in utf-8, my database too. I had encoding output problems in Intelli-j terminal with tomcat, that i managed to resolve using -Dfile.encoding=UTF-8 in Help | Edit Custom VM Options. But my data in my db is still wrong, even if in Intelli-J output i get the good result.
If i execute the script straight into pgadmin there is no problem.
I tried everything i could find to solve that, but nothing worked. I probably have conflict in the configuration now, cause i tried too many different stuff. My persistence.xml
<properties>
<property name="javax.persistence.jdbc.driver" value="org.postgresql.Driver" />
<property name="javax.persistence.jdbc.url" value="jdbc:postgresql://localhost:5432/DB" />
<property name="javax.persistence.jdbc.user" value="db" />
<property name="javax.persistence.jdbc.password" value="" />
<property name="hibernate.connection.useUnicode" value="true" />
<property name="hibernate.connection.characterEncoding" value="UTF-8" />
<property name="hibernate.connection.charSet" value="UTF-8"/>
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.hbm2ddl.auto" value="create" />
<property name="javax.persistence.sql-load-script-source" value="META-INF/data.sql"/>
<property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQL95Dialect"/>
<property name="hibernate.connection.autocommit" value="true" />
</properties>
It's my first message on stackoverflow so i hope i did everything properly ! Thanks !