<?xml version="1.0" encoding="utf-8"?>
<!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="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="connection.url">jdbc:mysql://localhost:3306/filemanager?useUnicode=true&characterEncoding=utf-8</property>
若<property name="connection.useUnicode" >true</property>
<property name="connection.characterEncoding" >utf-8</property>
connection必须加
<property name="connection.username">root</property>
<property name="connection.password"></property>
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
这里不要“connection.”加了反而“The dialect was not set. Set the property hibernate.dialect”
<property name="show_sql">true</property>
<property name="format_sql">true</property>
<mapping resource="com/huawei/ssh/model/File.hbm.xml"/>
<mapping resource="com/huawei/ssh/model/User.hbm.xml"/>
</session-factory>
</hibernate-configuration>
可以采用 <property name="connection.useUnicode">root</property>
建议使用Hibernate Synchronizer插件 可生成配置文件、映射文件并生成model类
乱码http://blog.163.com/xueling1231989@126/blog/static/10264080720123602241891/
http://www.blogjava.net/i369/articles/194855.html hibernate配置