Spring Mvc Hibernate编码多行导入sql

Spring Mvc Hibernate编码多行导入sql,第1张

Spring Mvc Hibernate编码/多行导入sql
  1. 确保将JDBC驱动程序设置为使用UTF-8:

jdbc:mysql://dbname?useUnipre=true&characterEncoding=utf-8

  1. 在中
    persistence.xml
    ,设置hibernate连接字符集

<property name="hibernate.connection.charSet" value="UTF-8"/>

如果

resources/import.sql
文件是多行,请添加:

<property   name="hibernate.hbm2ddl.import_files_sql_extractor"  value="org.hibernate.tool.hbm2ddl.MultipleLinesSqlCommandExtractor" />

或对于Spring Boot,在

application.properties

spring.jpa.properties.hibernate.connection.charSet=UTF-8spring.jpa.properties.hibernate.hbm2ddl.import_files_sql_extractor=org.hibernate.tool.hbm2ddl.MultipleLinesSqlCommandExtractor


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/5621837.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-15
下一篇 2022-12-15

发表评论

登录后才能评论

评论列表(0条)

保存