×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: XML
Posted by: JUNE CHERN
Added: Apr 6, 2021 1:27 AM
Views: 3941
Tags: hiber
  1. <?xml version='1.0' encoding='utf-8'?>
  2. <!DOCTYPE hibernate-configuration PUBLIC
  3.        "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
  4.        "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
  5. <hibernate-configuration>
  6.     <session-factory>
  7.         <!-- Database connection settings -->
  8.         <property name="connection.driver_class">com.mysql.jdbc.Driver</property>
  9.         <property name="connection.url">jdbc:mysql://127.0.0.1:3306/house?useUnicode=true&amp;characterEncoding=utf-8&amp;useSSL=false</property>
  10.         <property name="connection.username">root</property>
  11.         <property name="connection.password">root</property>
  12.         <!-- JDBC connection pool (use the built-in) -->
  13.         <property name="connection.pool_size">1</property>
  14.  
  15.         <!-- SQL dialect 配置使用何种数据库-->
  16.         <property name="dialect">org.hibernate.dialect.MySQL5InnoDBDialect</property>
  17.         <!-- Enable Hibernate's automatic session context management -->
  18.         <property name="current_session_context_class">thread</property>
  19.         <!-- Disable the second-level cache -->
  20.         <property name="cache.provider_class">org.hibernate.cache.NoCacheRegionFactoryAvailableException</property>
  21.         <!-- Echo all executed SQL to stdout -->
  22.         <property name="show_sql">true</property>
  23.         <!-- Drop and re-create the database schema on startup -->
  24.         <property name="hbm2ddl.auto">update</property>
  25.  
  26.         <!--Class与数据库表之间的映射关系文件-->
  27.         <mapping resource="mappers/User.hbm.xml"/>
  28.  
  29.     </session-factory>
  30. </hibernate-configuration>