Hibernate-orm:01.hibernate Huangrugeshi like

Source: Internet
Author: User

------------I do not have him, but the hand is ripe, humble and foolish, and eager to be hungry------------- for the friends who have learned the ORM framework, the hibernateorm, familiar with a little strange, familiar is nothing but the soul, unfamiliar is just some language 1.1: hibernate-orm Introduction

1.Hibernate is an object-relational mapping framework (ORM)that develops source code;

2. The lightweight encapsulation of JDBC enables the mapping of entity classes and tables in the database ;

3. is a fully automatic ORM framework;Hibernate can generate SQL statements automatically ;

4. The program Ape can operate the database completely according to the object-oriented programming idea .

Hibernate ORM: The subject of our research;

Hibernate Search: similar to lucence Full-Text Search

Hibernate Validator: validation Framework

Hibernate OGM: Operations for Nosql databases

1.2: Core configuration file hibernate.cfg.xml

<?xml version= "1.0" encoding= "UTF-8"?>
<! DOCTYPE hibernate-configuration Public
"-//hibernate/hibernate Configuration DTD 3.0//en"
"Http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd" >

Important content in the configuration file that needs our configuration:

a four-factor connection to a database

To manage various hbm.xml mapping files

the settings of the cache .

The SQL statement is displayed

Whether to format SQL statements

configuration of the 06.HBM2DDL

1.2: Core API 1. Configuration class the MyBatis of the "----------------" corresponds to Sqlsessionfactorybuilder

load Hibernate 's core configuration file, and be responsible for starting hibernate, creating sessionfactory Objects

2. sessionfactory Interface the MyBatis of the "----------------" corresponds to Sqlsessionfactory

Initialize Hibernate, which is the proxy for the data storage source, is responsible for creating the Session Object!

in a project we use a Sessionfactory is enough!

if we need to operate multiple databases, establish each database to specify a Sessionfactory!

3. Session Interface----------------"corresponds to the sqlsession of MyBatis

responsible for executing persisted objects. CRUD Operations! The thread is unsafe! can open a transaction! Create a Transaction Object!

Session ===> Sessions

HttpSession ===> User session

4. Transaction Interface

Operations for Transactions!

5. Query Interface

To facilitate our query of database data, there are two ways to implement the query:

01.sql

02.hql

6. Criteria Interface

Very similar to the query interface! Completely object-oriented thinking to operate the database!

Hibernate-orm:01.hibernate Huangrugeshi like

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.