<?xml version='1.0' encoding='gb2312'?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> <hibernate-configuration> <session-factory> <!--显示执行的SQL语句--> <property name="show_sql">true</property> <!--连接字符串--> <property name="connection.url">jdbc:mysql://localhost:3306/Test</property> <!--连接数据库的用户名--> <property name="connection.username">sa</property> <!--数据库用户密码--> <property name="connection.password">sa</property> <!--数据库驱动--> <property name="connection.driver_class">com.mysql.jdbc.Driver</property> <!--JDBC连接池(使用内置的连接池)--> <property name="connection.pool_size">1</property> <!--设置Hibernate自动管理上下文的策略--> <property name="current_session_context_class">thread</property> <!--选择使用的方言--> <property name="dialect">org.hibernate.dialect.MySQLDialect</property> <!--在启动时删除并重新创建数据库--> <property name="hbm2ddl.auto">create</property> <mapping resource="events/User.hbm.xml"/> <mapping resource="events/Student.hbm.xml"/> </session-factory> </hibernate-configuration>