执行带日语值的插入查询时,MySQL工作台可以正常工作。 但是当我从import.sql尝试它时,字符似乎是“????”在数据库中。
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</prop>
<prop key="hibernate.hbm2ddl.auto">create</prop>
<prop key="hibernate.connection.characterEncoding">UTF-8</prop>
<prop key="hibernate.connection.useUnicode">true</prop>
<prop key="hibernate.connection.CharSet">UTF-8</prop>
<prop key="hibernate.hbm2ddl.import_files">/import.sql</prop>
</props>
</property>
答案 0 :(得分:0)
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</prop>
<prop key="hibernate.hbm2ddl.auto">create</prop>
<prop key="hibernate.hbm2ddl.import_files">/import.sql</prop>
</props>
</property>
并使用网址连接为
<property name="jdbcUrl"
value="jdbc:mysql://localhost:3306/test?autoConnect=true&useUnicode=true&characterEncoding=utf-8" />