Hibernate master configuration file in a detailed

Source: Internet
Author: User

Abstract: Copyright Notice: This article for Bo Master original article, without Bo Master permission not reproduced.

Blog Address: http://www.cnblogs.com/caoyc/p/5595870.html

One, master profile naming rules

1. Default name:hibernate.cfg.xml

2. Default path: src root directory. is also the root of the class after compilation

Question: How do I load the master configuration file in a program?

Answer: new Configuration (). Configure ()

Of course we generally recommend using the default name and default path, which means that the name can be changed and the path can be changed.

  Question: How do we load the main profile name or path after we change it?

  Answer: We know that there are several overloaded methods for configure in the configuration class, and the return value is also a configuration object

Configuration Configure (): The main configuration file that loads the default name and default path

Configuration Configure (String Resource): Can load a profile at the specified location (in this project)

Configuration configure (file ConfigFile): Here you can load the local config file (on the local computer)

Configuration configure (URL URL): Can load profiles on the Internet

Hibernate master configuration file in a 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.