Hibernate持久化数据中文乱码

    xiaoxiao2021-03-25  105

    Hibernate持久化数据中文乱码 数据库编码为utf-8,开发环境编码也为utf-8,插入中文数据仍旧乱码 解决方法:

    修改Hibernate.cfg.xml中的hibernate.connection.url的值即在数据库名称后面加上参数?useUnicode=true&characterEncoding=UTF8

    <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=UTF8</property>
    转载请注明原文地址: https://ju.6miu.com/read-11787.html

    最新回复(0)