hibernate.cfg.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC"-//Hibernate/Hibernate Configuration DTD 3.0//EN""http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration><session-factory><!-- Database connection settings --><!-- 配置驱动 --><property name="connection.driver_class">com.mysql.jdbc.Driver</property><property name="connection.url">jdbc:mysql://127.0.0.1:3306/hibe1</property><property name="connection.username">root</property><property name="connection.password">root</property><!-- 是否根据hbm文件生成数据库 --><property name="hibernate.hbm2ddl.auto">update</property><!-- 是否打印sql语句 --><property name="show_sql">true</property><!-- 格式化输出sql语句 --><property name="hibernate.format_sql">true</property><property name="hibernate.use_sql_comments">true</property><!-- C3P0连接池设定 --><!-- 使用c3po连接池 配置连接池提供的供应商 --><property name="connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider </property><!-- 配置方言. --><property name="dialect">org.hibernate.dialect.MySQLDialect</property><mapping resource="cn/itcast/onetomany/Customer.hbm.xml" /><mapping resource="cn/itcast/onetomany/Order.hbm.xml" /></session-factory>
</hibernate-configuration>