<?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">
<mapping resource="com/wenhz/pro/person.hbm.xml"/>
</session-factory>
</hibernate-configuration>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
//配置sessionFactory ,只有一个
<session-factory>
//配置数据库方言
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
//配置数据库驱动类
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
//配置数据库连接地址,和数据默认编码
<property name="connection.url">jdbc:mysql://localhost:3306/hibernate01?useUnicode=true&characterEncoding=UTF-8</property>
//配置数据用户名
<property name="connection.username">root</property>
//配置数据库密码
<property name="connection.password">123456</property>
//配置hibernate在数据库中自动维护表结构,没有表就创建表,有表就维护表
<property name="hbm2ddl.auto">update</property><mapping resource="com/wenhz/pro/person.hbm.xml"/>
</session-factory>
</hibernate-configuration>