<?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> <property name="dialect"> org.hibernate.dialect.MySQLDialect </property> <property name="connection.url"> jdbc:mysql://localhost:3306/db4myeclipse </property> <property name="connection.username">root</property> <property name="connection.password">admin</property> <property name="connection.driver_class"> com.mysql.jdbc.Driver </property> <property name="myeclipse.connection.profile"> db4myeclipse </property> <property name="hibernate.jdbc.batch_size">50</property> <property name="hibernate.show_sql">true</property> <!-- set to thread else throw no session found for current thread when using SessionFactory.currentSession() SessionFactoryImpl使用ThreadLocalSessionContext管理thread Session --> <property name="current_session_context_class">thread</property> <!-- L2 cache settings--> <!-- <property name="hibernate.cache.use_second_level_cache">true</property> <property name="hibernate.cache.provider_class"> org.hibernate.cache.EhCacheProvider </property> --> <!-- By default declarations in hbm files have higher priority than annotation metadata in classes. --> <mapping resource="com/jaeson/hibernatestudy/bean/IdCard.hbm.xml" /> <mapping resource="com/jaeson/hibernatestudy/bean/Role.hbm.xml" /> <mapping resource="com/jaeson/hibernatestudy/bean/Department.hbm.xml" /> <mapping resource="com/jaeson/hibernatestudy/bean/User.hbm.xml" /> <mapping class="com.jaeson.hibernatestudy.bean.User" /> </session-factory> </hibernate-configuration>