Hibernate learning note one of Hibernate profile

Source: Internet
Author: User

Hibernate is an open source object-relational mapping framework that provides JDBC with a very lightweight object encapsulation that maps Pojo to database tables, and is a fully automated ORM framework hibernate can automatically generate SQL statements, automatically execute, So that Java programmers can use object programming thinking to manipulate the database at will. Hibernate can be applied to any JDBC application, both in Java client applications and in servlet/jsp Web applications, and most revolutionary of all, hibernate can replace CMP in the EE architecture of the EJB application. The task of achieving data persistence.   Persistence (persistence), which is to save data (such as in-memory objects) to a storage device that can be permanently saved (such as a disk). The primary application of persistence is to store in-memory objects in relational databases, and of course, in disk files, XML data files, and so on. Persistence is the mechanism by which program data is transformed between a persistent state and a transient state. JDBC is a kind of persistence mechanism. File IO is also a persistence mechanism.   Hibernate is a lot of redundancy for JDBC further encapsulation         without using hiberante to do persistence layer development, such as: various JDBC statements, connection management, So there's hibernate that encapsulates JDBC, and we don't have to manipulate the data, just manipulate it.   Second, from a hierarchical perspective         We know the very typical three-tier architecture: The presentation layer, the business layer, and the persistence layer. Hiberante is also the framework of the persistence layer, and there are many frameworks for the persistence layer, such as IBATIS,NHIBERNATE,JDO,OJB,EJB and so on.   Hibernate is an ORM (Object Relational Mapping) framework for open source.       ORM, the object-relational Mapping, is the role of mapping between relational databases and objects. Maps from objects (object) to Relationships (Relation), and then from relationships to objects. In this way, when we operate the database, we do not need to deal with the complex SQL, as long as the operation of the object as it does it (the relational database of the field in memory mapped to the object's properties).  hibernate's core: , we can see Hibernate's six core interfaces, two major profiles, and their direct relationships. HAll the content of ibernate is here. Well, let's go from top to bottom and make a brief summary of each interface. 1. Configuration interface: Responsible for configuring and starting Hibernate2, Sessionfactory interface: Responsible for initializing the Hibernate3, session interface: The CRUD operation for persistent objects 4, transaction interface: Responsible for transaction 5, query interface and Criteria interface: responsible for performing various database queries   NOTE: A configuration instance is an object during startup, and once Sessionfactory is created it is discarded.  hibernate Advantage/Disadvantage:  Advantages: 1, more object       to the object of the thinking operation database, we only need to manipulate the object can be, development more object. 2, portability       because hibernate does a persistent layer of encapsulation, you don't know the database, and all the code you write is reusable. 3. Hibernate is a non-intrusive framework that does not have an intrusive framework that we call a lightweight framework. Hibernate does not need to inherit any classes and does not need to implement any interfaces. Such objects are called Pojo objects. 4, Hibernate code testing is convenient. 5, improve efficiency, improve productivity.   Disadvantage: 1, the use of database characteristics of the statement, it will be difficult to tune 2, the large number of data updates there are problems 3, the system has a large number of attack query function   

One of the Hibernate learning notes Hibernate introduction

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.