问题描述:
使用Hibernate连接MySQL,并往表中插入记录时,会出现中文乱码的情况。
解决方案:
在hibernate.cfg.xml中应该这样写:
<property name="connection.url">jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=UTF-8</property>