Hibernate learning Notes (2)---hibernate core file

Source: Internet
Author: User
Tags tag name metabase

The configuration hibernate.cfg.xmlhibernate configuration file contains the basic information required to connect the persistence layer to the mapping file. Configuration file name defaults to hibernate.cfg.xml.hibernate.cfg.xml file configuration
<span style= "FONT-SIZE:18PX;" >< DTD information for!--configuration file--><! DOCTYPE hibernate-configuration Public "-//hibernate/hibernate configuration DTD 3.0//en" "Http://hibern                   Ate.sourceforge.net/hibernate-configuration-3.0.dtd "><!--Generated by MyEclipse hibernate Tools. -->< the root element of the!--configuration file-->

  

Hibernate mapping File Configuration (*.hbm.xml) the mapping between persisted classes of objects and relational databases through the. xml file configuration, typically namedPersistent class name. Hbm.xml, this file is typically placed under the same path as the persisted class object
*.hbm.xml file configuration (typically there are a number of persisted class objects that need to configure how many configuration files)Configuration example with User.hb,.xml file User.hbm.xml
<span style= "FONT-SIZE:18PX;" >< DTD information for!--configuration file--><! DOCTYPE hibernate-mapping Public "-//hibernate/hibernate mapping DTD 3.0//en" "http://hibernate.sourceforge.net/ HIBERNATE-MAPPING-3.0.DTD "><!--mapping file autogenerated by MyEclipse persistence Tools-->

  

Profile extensions Hibernate.cfg.xml configuring C3P0 connection pooling
<span style= "FONT-SIZE:18PX;" ><!--Set the maximum number of connections for the C3P0 connection pool--><property name= "Hibernate.c3p0.max_size" >50</property><!-- Set the minimum number of connections for the C3P0 connection pool--><property name= "Hibernate.c3p0.min_size" >1</property><!--Set the timeout length for connections in the C3P0 connection pool, Throws an exception when exceeded, in milliseconds--><property name= "Hibernate.c3p0.timeout" >1000</property><!-- Set the number of C3P0 cache statements--><property name= "Hibernate.c3p0.max_statements" >60</property></span >

  

For more C3P0 connection pool configurations, please refer to the properties file of Hibernate's etc sub-directory
*.hbm.xml---Collection mapping configuration set,map, List collection Configuration < collection class Map element >< collection foreign key ><j collection index field >< collection element/></Collection class mapping element >

Hibernate learning Notes (2)---hibernate core file

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.