zoukankan      html  css  js  c++  java
  • hibernate.cfg.xml配置

    <!--标准的XML文件的起始行,version='1.0'表明XML的版本,encoding='gb2312'表明XML文件的编码方式--> 
                    <?xml version='1.0' encoding='gb2312'?> 
    <!-- 表明解析本XML文件的DTD文档位置,DTD是Document Type Definition 的缩写,即文档类型的定义,XML解析器使用DTD文档来检查XML文件的合法性。 hibernate.sourceforge.net/hibernate-configuration-3.0dtd可以在 Hibernate3.1.3软件包中的src\org\hibernate目录中找到此文件--> 
    <!DOCTYPE hibernate-configuration PUBLIC 
              "-//Hibernate/Hibernate Configuration DTD 3.0//EN" 
              "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> 
        <!--声明Hibernate配置文件的开始-->      
        <hibernate-configuration> 
        <!--表明以下的配置是针对session-factory配置的,SessionFactory是Hibernate中的一个类,这个类主要负责保存HIbernate的配置信息,以及对Session的操作--> 
          <session-factory>    
          <!--配置数据库的驱动程序,Hibernate在连接数据库时,需要用到数据库的驱动程序--> 
              <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver </property> 
          <!--设置数据库的连接url:jdbc:mysql://localhost/hibernate,其中localhost表示mysql服务器名称,此处为本机,    hibernate是数据库名-->  
                <property name="hibernate.connection.url">jdbc:mysql://localhost/hibernate </hibernate> 
        <!--连接数据库是用户名--> 
              <property name="hibernate.connection.username">root </property> 
              <!--连接数据库是密码--> 
              <property name="hibernate.connection.password">123456 </property>        
              <!--数据库连接池的大小--> 
              <property name="hibernate.connection.pool.size">20 </property>        
            <!--是否在后台显示Hibernate用到的SQL语句,开发时设置为true,便于差错,程序运行时可以在Eclipse的控制台显示Hibernate的执行Sql语句。项目部署后可以设置为false,提高运行效率--> 
            <property name="hibernate.show_sql">true </property> 
            <!--jdbc.fetch_size是指Hibernate每次从数据库中取出并放到JDBC的Statement中的记录条数。Fetch Size设的越大,读数据库的次数越少,速度越快,Fetch Size越小,读数据库的次数越多,速度越慢--> 
            <property name="jdbc.fetch_size">50 </property> 
            <!--jdbc.batch_size是指Hibernate批量插入,删除和更新时每次操作的记录数。Batch Size越大,批量操作的向数据库发送Sql的次数越少,速度就越快,同样耗用内存就越大--> 
            <property name="jdbc.batch_size">23 </property> 
            <!--jdbc.use_scrollable_resultset是否允许Hibernate用JDBC的可滚动的结果集。对分页的结果集。对分页时的设置非常有帮助--> 
            <property name="jdbc.use_scrollable_resultset">false </property> 
            <!--connection.useUnicode连接数据库时是否使用Unicode编码--> 
            <property name="Connection.useUnicode">true </property> 
            <!--connection.characterEncoding连接数据库时数据的传输字符集编码方式,最好设置为gbk,用gb2312有的字符不全--> 
        <property name="connection.characterEncoding">gbk </property>      
            
            <!--hibernate.dialect 只是Hibernate使用的数据库方言,就是要用Hibernate连接那种类型的数据库服务器。--> 
              <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect </property> 
            <!--指定映射文件为“hibernate/ch1/UserInfo.hbm.xml”-->        
              <mapping resource="org/mxg/UserInfo.hbm.xml"> 
      </session-factory> 
      </hibernate-configuration>    
      
      

                                                Hibernate SQL方言 (hibernate.dialect)

    RDBMS方言
    DB2 org.hibernate.dialect.DB2Dialect
    DB2 AS/400 org.hibernate.dialect.DB2400Dialect
    DB2 OS390 org.hibernate.dialect.DB2390Dialect
    PostgreSQL org.hibernate.dialect.PostgreSQLDialect
    MySQL org.hibernate.dialect.MySQLDialect
    MySQL with InnoDB org.hibernate.dialect.MySQLInnoDBDialect
    MySQL with MyISAM org.hibernate.dialect.MySQLMyISAMDialect
    Oracle (any version) org.hibernate.dialect.OracleDialect
    Oracle 9i/10g org.hibernate.dialect.Oracle9Dialect
    Sybase org.hibernate.dialect.SybaseDialect
    Sybase Anywhere org.hibernate.dialect.SybaseAnywhereDialect
    Microsoft SQL Server org.hibernate.dialect.SQLServerDialect
    SAP DB org.hibernate.dialect.SAPDBDialect
    Informix org.hibernate.dialect.InformixDialect
    HypersonicSQL org.hibernate.dialect.HSQLDialect
    Ingres org.hibernate.dialect.IngresDialect
    Progress org.hibernate.dialect.ProgressDialect
    Mckoi SQL org.hibernate.dialect.MckoiDialect
    Interbase org.hibernate.dialect.InterbaseDialect
    Pointbase org.hibernate.dialect.PointbaseDialect
    FrontBase org.hibernate.dialect.FrontbaseDialect
    Firebird org.hibernate.dialect.FirebirdDialect
  • 相关阅读:
    阿里笔试题—战报交流
    2 基于梯度的攻击——PGD
    1 基于梯度的攻击——FGSM
    0 对抗样本
    自然语言处理 复习笔记 3
    自然语言处理 复习笔记 2
    自然语言处理 复习笔记 1
    GRU
    1*1卷积核的作用
    BP原理
  • 原文地址:https://www.cnblogs.com/yaoxing92/p/2971480.html
Copyright © 2011-2022 走看看