Hibernate configuration file Detailed parsing

Source: Internet
Author: User

In the Javaweb development, hibernate framework is commonly used, can help us save a lot of time, the following is the configuration file parsing hibernate.

The default name for hibernate configuration files is: Hibernate.cfg.xml default is Web-inf/class.

<?xml version= "1.0" encoding= "Utf-8"?>

Configuration file dto information (dto explanation Baidu Encyclopedia)

<! DOCTYPE hibernate-configuration Public

"-//hibernate/hibeinate configurantion DTD 3.0//EM"

"Http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd" >

The root element of the configuration file

<session-factory>

Configuring the JDBC driver (for example, MySQL)

<property name= "Hibernate.connection.driver_class" >com.mysql.jdbc.Driver</property>

Configure the database connection URL

<property name= "Hibernate.connection.url" >jdbc:mysql://localhost:3306/aisky</property>

Configure database Users

<property name= "Hibernate.connection.username" >root</property>

Configure Database Password

<property name= "Hibernate.connection.password" >root</property>

Configure Data dialect

<property name= "Hibernate.dialect" >org.hibernate.dialect.MySQLDialect</property>

Configure the number of built-in JDBC connections

<property name= "Hibernate.connection.pool.size" >1</property>

Configure Database dialect

<peoperty name= "dialect" >org.hibernate.dialect.mysqldialect</peoperty>

List all the mapping file information

<mappiong resource>org/hibernate.entity/user.hbm.xml</mappiong resource>

</session-factory>

JDBC Connection Property sheet

Property name
Role
Hibernate.connection.driver_class
Loading the JDBC Driver
Hibernate.connection.url
JDbC URL connection string
Hibernate.connection.name
Database user Name
Hibernate.connection.password
Database Password
Hibernate.connection.pool_size
Maximum number of pool connections


Hibernate configuration file Detailed parsing

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.