<hibernate-configuration>
−
<session-factory>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.password">root</property>
<property name="hibernate.connection.url">jdbc:mysql:///test</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.dialect">org.hibernate.dialect.MySQL5InnoDBDialect</property>
<property name="hibernate.hbm2ddl.auto">update</property>
<property name="hibernate.show_sql">true</property>
<property name="hibernate.cache.use_second_level_cache">true</property>
<property name="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</property>
<property name="hibernate.cache.use_query_cache">true</property>
<mapping resource="org/cric/model/Student.hbm.xml"/>
<mapping resource="org/cric/model/Clazz.hbm.xml"/>
</session-factory>
</hibernate-configuration>
−
<session-factory>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.password">root</property>
<property name="hibernate.connection.url">jdbc:mysql:///test</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.dialect">org.hibernate.dialect.MySQL5InnoDBDialect</property>
<property name="hibernate.hbm2ddl.auto">update</property>
<property name="hibernate.show_sql">true</property>
<property name="hibernate.cache.use_second_level_cache">true</property>
<property name="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</property>
<property name="hibernate.cache.use_query_cache">true</property>
<mapping resource="org/cric/model/Student.hbm.xml"/>
<mapping resource="org/cric/model/Clazz.hbm.xml"/>
</session-factory>
</hibernate-configuration>
Hibernate配置详解
本文详细介绍了Hibernate框架的配置方法,包括数据库连接设置、缓存配置、映射文件引用等。通过具体示例展示了如何使用XML进行配置,适用于MySQL数据库。
1252

被折叠的 条评论
为什么被折叠?



