-
Sørg for, at du indstiller JDBC-driveren til at bruge UTF-8:
jdbc:mysql://dbname?useUnicode=true&characterEncoding=utf-8
-
I
persistence.xml
, indstil dvaleforbindelsens tegnsæt:<property name="hibernate.connection.charSet" value="UTF-8"/>
Hvis din resources/import.sql
filen er multi-line, tilføj:
<property
name="hibernate.hbm2ddl.import_files_sql_extractor"
value="org.hibernate.tool.hbm2ddl.MultipleLinesSqlCommandExtractor"
/>
eller for Spring Boot, i application.properties
:
spring.jpa.properties.hibernate.connection.charSet=UTF-8
spring.jpa.properties.hibernate.hbm2ddl.import_files_sql_extractor=org.hibernate.tool.hbm2ddl.MultipleLinesSqlCommandExtractor