Hibernate安插中文字符到MySQL

Hibernate插入中文字符到MySQL在hibernate.cfg.xml里的url属性加上jdbc:mysql://localhost:3306/testuseUn

Hibernate插入中文字符到MySQL

在hibernate.cfg.xml里的url属性加上jdbc:mysql://localhost:3306/testuseUnicode=true&characterEncoding=UTF-8

?

或者加上<property name="connection.useUnicode">true</property>?

<property name="connection.characterEncoding">UTF-8</property>?

两个属性。
注:&amp;是W3C规定的xml/html里&的表示法,并不是url标准