Hibernate configuration Detailed

Source: Internet
Author: User

<!--the starting line of the standard XML file, version= ' 1.0 ' indicates the version of the XML, encoding= ' gb2312 ' indicates how the XML file is encoded--<?xml version= ' 1.0 ' encoding= ' gb2312 '?> <!--indicates the location of the DTD document parsing this XML file, which is the abbreviation for document type definition, which is the definition of the documents types, and the XML parser uses the DTD document to check the legitimacy of the XML file. Hibernate.sourceforge.net/HIBERNATE-CONFIGURATION-3.0DTD can find this file in the Src\org\hibernate directory in the Hibernate3.1.3 software package-and <! DOCTYPE hibernate-Configuration Public"-//hibernate/hibernate Configuration DTD 3.0//en" "http://hibernate.sourceforge.net/hibernate-configuration-3.0 The. DTD > <!--declares that the hibernate profile begins--Factory configuration, Sessionfactory is a class in Hibernate, which is responsible for saving hibernate configuration information and the operation of the session-<session-factory> <!--configuration database driver, hibernate requires a database driver when connecting to the database-<proper Ty name= "Hibernate.connection.driver_class" >oracle.jdbc.driver.oracledriver </property> <!--setting up the database connection U Rl:jdbc:oracle:thin: @localhost: 1521:orcl, where localhost represents the Oracle database server name, this is native, ORCL is the database name--<property name= "h           Ibernate.connection.url ">jdbc:oracle:thin: @localhost:1521:orclwhether the SQL statement that Hibernate uses is displayed in the background, set to true at development time, makes it easy to check for errors, and the program can display hibernate's execution SQL statements in the console of Eclipse at run time. The project can be set to false after deployment to improve operational efficiency--<property name= "Hibernate.show_sql" >true</property> <!--jdbc.fetch_size refers to the number of records that hibernate takes each time it pulls out of the database and puts it into JDBC's statement. The larger the fetch size is, the less times the database is read, the faster the fetch size, the more times the database is read , the slower the speed--<property name= "Jdbc.fetch_size" >50 </property> <!--jdbc.batch_size refers to the number of records per operation that hibernate bulk inserts, deletes, and updates. The larger the batch size, the smaller the number of times the batch operation sends SQL to the database, the faster it will be, and the greater the memory consumption--<property name= "Jdbc.batch_size" >23 </property> <!--Jdbc.use_scrollable_resultse T allows hibernate to use a scrollable result set of JDBC. The result set for the pagination. Very helpful for paging settings-<property name= "Jdbc.use_scrollable_resultset" >false</property> <!--Connection.useunicode when connecting to a database using Unicode--<property name= "connection . Useunicode ">true</property> <!--connection.characterencoding the transmission character set encoding of data when connecting to a database, preferably set to GBK, with gb2312 characters not all--and Lt;property name= "connection.characterencoding" &GT;GBK </property> <!--hibernate.dialect Yes Hibernate uses the database dialect, which is to use Hibernate to connect to that type of database server. --<property name= "Hibernate.dialect" >org.hibernate.dialect.OracleDialect</property> & lt;! --Specify the mapping file as "Hibernate/ch1/userinfo.hbm.xml"--<mapping resource= "Org/mxg/userinfo.hbm.xml" > & lt;/session-factory> class= "Org.apache.commons.dbcp.BasicDataSource" destroy-method= "Close" > <!--Connection driver-<property name= "drive Rclassname "value=" ${jdbc.driverclassname} "/> <!--connection URL--<property name=" url "value=" ${jdbc.url}   "/> <!--Connect user name--<property name=" username "value=" ${jdbc.username} "/> <!--connection password --<property name= "password" value= "${jdbc.password}"/> </bean> <bean id= "Hbsessionfacto Ryclass= "Org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean" > <property name= "DataSource" ref= "DataSource"/> <property name= "configlocation" > <!--Hibernate configuration file Location--<valu E>web-inf/hibernate.cfg.xml </value> </property> <property name= "ConfigurationClass" value= "O          Rg.hibernate.cfg.AnnotationConfiguration "/> <property name=" hibernateproperties "> <props> <!--the dialect for the Oracle database, the specific relational database generates optimized SQL--<prop key= "Hibernate.dialect" > Org.hibernate.dialect. Oracledialect </prop> <!--Select HQL Parser--<prop key= "Hibernate.query.factory_class"  ; Org.hibernate.hql.ast.ASTQueryTranslatorFactory </prop> <!--whether to print the SQL statement in the console--<prop k ey= "Hibernate.show_sql" >true</prop> <!--when Hibernate.use_outer_join is opened in Hibernate system parameters, this parameter is used to allow outer join to load data from this collection. --<prop key= "Hibernate.use_outer_join" >true</prop> <!--is turned on by default, enabling Cglib reflection optimization. Cglib is used to dynamically generate PO bytecode in hibernate, and opening optimizations can speed up bytecode construction--<prop key= "Hibernate.cglib.use_reflection_optimizer" ;true</prop> <!--output formatted SQL for easier viewing--<prop key= "Hibernate.format_sql" >true</prop> <!--"Useunicode" and "characterencoding" determine whether it encode during client and server-side transfers, and how to encode- <prop key= "Hibernate.connection.useUnicode" >true</prop> <!--allow query caching, individual queries still need to be set to cacheable. --<prop key= "Hibernate.cache.use_query_cache" >false </prop> <prop key= "hibernate.default_batch_fetch_size" >16 </prop> <!--The maximum number of active connection pools --<prop key= "hibernate.dbcp.maxActive" >100 </prop> <!--when the connection in the connection pool has been exhausted, how will dbcp handle it ( 0 = failed, 1 = wait, 2 = growth)--<prop key= "hibernate.dbcp.whenExhaustedAction" >1 </prop> &lt ;! --Maximum waiting time--<prop key= "hibernate.dbcp.maxWait" >1200 </prop> <!--No one is connected, the maximum idle connection Number--> <prop key= "hibernate.dbcp.maxIdle" >10 </prop> <!--The following is the handling of prepared statement,  Ditto. --<prop key= "hibernate.dbcp.ps.maxActive" >100 </prop> <prop key= "hibernate.dbcp.ps.whe Nexhaustedaction ">1 </prop> <prop key=" hibernate.dbcp.ps.maxWait ">1200 </prop> < Prop key= "Hibernate.dbcp.ps.maxIdle" >10 </prop> </props> </property> </bean>

Hibernate configuration Detailed

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.