日期:2014-05-16 浏览次数:20585 次
Hibernate配置文件中指定MySQL数据库的编码方式: 1) <hibernate-configuration>? <hibernate-configuration>? </property> </hibernate-configuration><property name="connectio.useUnicode">true</property>?
<session-factory>?
<property name="dialect">?
org.hibernate.dialect.MySQLDialect?
</property>?
<property name="connection.url">?
jdbc:mysql://127.0.0.1:3306/db?useUnicode=true&characterEncoding=utf-8?
</property>?
<property name="connection.username">root</property>?
<property name="connection.password">root</property>?
<property name="connection.driver_class">?
com.mysql.jdbc.Driver?
</property>?
<property name="myeclipse.connection.profile">con</property>?
<mapping resource="com/hib/entity/Mytable.hbm.xml" />?
</session-factory>?
2)
<session-factory>?
<property name="dialect">?
org.hibernate.dialect.MySQLDialect?
</property>?
<property name="connection.url">?
jdbc:mysql://127.0.0.1:3306/db
<property name="connection.characterEncoding">utf-8</property>?
<property name="connection.username">root</property>?
<property name="connection.password">root</property>?
<property name="connection.driver_class">?
com.mysql.jdbc.Driver?