<!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 name="foo">
        <!-- 配置数据库信息 --> 
        <property name="dialect">org.hibernate.dialect.MySQLDialect</property>
        <property name="connection.url">jdbc:mysql:///hibernate_20120328</property>
        <property name="connection.driver_class">com.mysql.jdbc.Driver</property>
        <property name="connection.username">root</property>
        <property name="connection.password">hyy</property>
        <!-- 其他配置 -->
        <property name="hibernate.show_sql">true</property>
        <mapping resource="com/eduask/htl/User.hbm.xml"/>
    </session-factory>
</hibernate-configuration>

aaaa

<!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 name="foo">
        <!-- 配置数据库信息 --> 
        <property name="dialect">org.hibernate.dialect.MySQLDialect</property>
        <property name="connection.url">jdbc:mysql:///hibernate_20120328</property>
        <property name="connection.driver_class">com.mysql.jdbc.Driver</property>
        <property name="connection.username">root</property>
        <property name="connection.password">hyy</property>
        <!-- 其他配置 -->
        <property name="hibernate.show_sql">true</property>
        <mapping resource="com/eduask/htl/User.hbm.xml"/>
    </session-factory>
</hibernate-configuration>
aaa.java