[Original] Pro hibernate 3 notes and summary (6) Chapter 2 integrated configuration of Hibernate

Source: Internet
Author: User
/**
Author: willpower
Source: rifoo Technology (http://www.rifoo.com)
Date: 2006-06
Remarks: Reprinted please keep the above statement
**/

Today, let's take a look at the hibernate configuration file. There are two types: Property file and XML file.

Hibernate property File(Default hibernate. properties ):
1. You can configure JDBC connections.
2. If JDBC is managed by containers, such as WebLogic, you can specify the JNDI name here.
3. You can specify the SQL dialect to manage the SQL language between different databases (we will learn the SQL dialect later)

Xml configuration file(Hibernate. cfg. xml by default ):
1. You can configure the hibernate ing file.
2. You can configure the cache, listener, and JNDI name of sessionfactory.
3. Using hibernate. cfg. XML will overwrite the settings in hibernate. properties.

A simple example:

<? XML version = "1.0" encoding = "UTF-8"?>
<! Doctype hibernate-Configuration System
"[Url] http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd#/url]">
<Hibernate-configuration>
<Session-factory>
<Property name = "dialect"> org. hibernate. dialect. hsqldialect </property>
<Mapping jar = "hibernate-mappings.jar"/>
<Mapping Resource = "com/apress/hibernate/user. HBM. xml"/>
</Session-factory>
</Hibernate-configuration>

 

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.