zoukankan      html  css  js  c++  java
  • Object Relational Mapping框架之Hibernate

    复制代码
     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     
     6 <hibernate-configuration>
     7     <session-factory>
     8         <!-- 数据库连接的配置: -->
     9         <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
    10         <property name="hibernate.connection.url">jdbc:mysql:///hibernate_crm</property>
    11         <property name="hibernate.connection.username">root</property>
    12         <property name="hibernate.connection.password">123</property>
    13         
    14         <!-- 配置C3P0连接池: -->
    15         <property name="connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</property>
    16         <!--在连接池中可用的数据库连接的最少数目 -->
    17         <property name="c3p0.min_size">5</property>
    18         <!--在连接池中所有数据库连接的最大数目  -->
    19         <property name="c3p0.max_size">20</property>
    20         <!--设定数据库连接的过期时间,以秒为单位,如果连接池中的某个数据库连接处于空闲状态的时间超过了timeout时间,就会从连接池中清除 -->
    21         <property name="c3p0.timeout">120</property>
    22          <!--每3000秒检查所有连接池中的空闲连接 以秒为单位-->
    23         <property name="c3p0.idle_test_period">3000</property>
    24         
    25         <!-- 
    26             配置数据库事务的隔离级别:
    27             1、read uncommitted (1)  : 脏读,可重复读,虚读三种情况都有可能发生。
    28             2、read committed (2)    : 避免脏读,可重复读和虚读有可能发生。
    29             3、repeatable read  (4)  : 避免脏读和可重复读,但是虚读有可能发生。
    30             4、serializable  (8)     :  以上出现的情况都能解决。
    31          -->
    32          <property name="hibernate.connection.isolation">4</property>
    33          
    34          <!-- hibernate中设置可以使用与当前线程绑定的session连接对象: -->
    35          <property name="hibernate.current_session_context_class">thread</property>
    36          
    37         
    38         <!-- hibernate的相关属性配置: -->
    39         <!-- 必须配置:mysql的方言配置 -->
    40         <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
    41         <!-- 可选配置:显示sql、格式化sql、hbm2ddl等 -->
    42         <property name="hibernate.show_sql">true</property>
    43         <property name="hibernate.format_sql">true</property>
    44         <property name="hibernate.hbm2ddl.auto">update</property>
    45         
    46         <!-- 加载映射文件: -->
    47         <mapping resource="com/itheima/domain/Customer.hbm.xml"/>
    48         <mapping resource="com/itheima/domain/LinkMan.hbm.xml"/>
    49         <mapping resource="com/itheima/domain/User.hbm.xml"/>
    50         <mapping resource="com/itheima/domain/Role.hbm.xml"/>
    51         
    52     </session-factory>
    53 </hibernate-configuration>
    复制代码
  • 相关阅读:
    Something I know about WebDynpro
    Details about support package implementation
    CRM Middleware Performance Topics
    Way to configure the logon navigaion layouts via Business Roles in CRM
    DOM 常用节点类型和方法
    第一届 xdef 会议日程
    去除百度音乐盒广告的chrome插件 持续更新
    从人人网抓取高校数据信息,包括,省份 高校 院系 (提供最终SQL文件下载)
    PHP 与 JSON
    解决HTTPS 发送请求走socket问题
  • 原文地址:https://www.cnblogs.com/wangchaoyuana/p/7545281.html
Copyright © 2011-2022 走看看