HibernateMySQL中解方案
本文考自:http://blog.tremend.ro/2007/08/14/how-to-set-the-default-charset-to-utf-8-for-create-table-when-using-hibernate-with-java-persistence-annotations/,感提供者spostelnicu.
:hibernatemysql中,新增和修改出中文
解:
步一:hibernate.cfg.xml中的connection.url值加入characterEncoding=utf8,具如下:
文件:hibernate.cfg.xml容
之後,hibernate的方言映身到文件:
文件: hibernate.cfg.xml<!DOCTYPE hibernate-configuration PUBLIC"-//Hibernate/Hibernate Configuration DTD 3.0//EN""http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"><hibernate-configuration> <session-factory>...<property name="hibernate.connection.charSet">utf8(或utf-8)</property>... <session-factory><hibernate-configuration>
小弟只是略懂皮毛,引玉,希望高手能提供更好的解方案,如有不足之,高手留言提....多...