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