zoukankan      html  css  js  c++  java
  • Hibernate配置文件讲解

    1. hibernate.query.substitutions yes 'Y', no 'N' 配置别名,如可以用'Y'代替yes,用'N'代替no;
    2. hibernate.query.factory_class org.hibernate.hql.internal.classic.ClassicQueryTranslatorFactory关于查询工厂的配置,如果你有更好的查询方式,你可以实现他的接口,自己写查询方法;
         3.   ## JNDI Datasource
               #hibernate.connection.datasource jdbc/test
               #hibernate.connection.username db2
              #hibernate.connection.password db2
              该配置用于配置服务器上数据源的配置;
        4.   ## MySQL
    #hibernate.dialect org.hibernate.dialect.MySQLDialect
    #hibernate.dialect org.hibernate.dialect.MySQLInnoDBDialect
    #hibernate.dialect org.hibernate.dialect.MySQLMyISAMDialect
    #hibernate.connection.driver_class com.mysql.jdbc.Driver
    #hibernate.connection.url jdbc:mysql:///test
    #hibernate.connection.username gavin
    #hibernate.connection.password
    对于不同数据库的不同配置,数据库方言,数据库名称和密码等配置信息;

    5.数据库连接池的配置,但是强度不够,测试足够用,生产环境使用时是远远不够的;
    hibernate.connection.pool_size 1
    ###########################
    ### C3P0 Connection Pool###
    ###########################

    #hibernate.c3p0.max_size 2 //最多连接数
    #hibernate.c3p0.min_size 2 //最少连接数,系统初始化时就存在,当少于该连接数时,直接取出用即可,如果多于该连接数,再新建连接
    #hibernate.c3p0.timeout 5000 //当连接超过最大连接数时,不再产生连接,如果超过所设置的timeout时间限制后,系统会报错
    #hibernate.c3p0.max_statements 100
    #hibernate.c3p0.idle_test_period 3000
    #hibernate.c3p0.acquire_increment 2
    #hibernate.c3p0.validate false

    6.对于分布式事务的处理,如操作多个数据库,则用jta 的事务;
    #jta.UserTransaction jta/usertransaction
    #jta.UserTransaction javax.transaction.UserTransaction
    #jta.UserTransaction UserTransaction

    7.批量更新时,一次更新的条数
    #hibernate.jdbc.batch_size 5
    #hibernate.jdbc.batch_size 0

    8.读取数据时,如select * from user,数据库不会一下子返回所有的数据,如果数据过多的话,可能导致内存溢出;如果遍历的话,再返回其他的数据,不同的数据库处理的方式不一样;
    ## set the JDBC fetch size
    #hibernate.jdbc.fetch_size 25





  • 相关阅读:
    中国剩余定理
    Codeforces 240 F. TorCoder
    ZOJ 1202 Divide and Count
    洛谷 3380 【模板】二逼平衡树(树状数组套权值线段树)
    bzoj 3196/ Tyvj 1730 二逼平衡树 (线段树套平衡树)
    uva 10791
    uva 699 The Falling Leaves
    uva 839 Not so Mobile
    2017 济南综合班 Day 5
    2017 济南综合班 Day 4
  • 原文地址:https://www.cnblogs.com/zmpandzmp/p/3648771.html
Copyright © 2011-2022 走看看