用session.save(obejct)时,数据库中文数据发生乱码,解决方案如下,
在<session-factory></session-factory>之间加入这样一段代码:
<property name="connection.useUnicode">true</property>
<property name="connection.characterEncoding">gbk</property>
这样就ok,加<property name="hibernate.connection.url">jdbc:mysql://localhost:3306/sysnews?useUnicode=true&characterEncoding=gb2312</property>会报错。