Basics of "SSH Advanced path" hibernate

Source: Internet
Author: User

Before starting to learn hibernate, it was always said that hibernate is not difficult, but a further encapsulation of JDBC. is not difficult, is it really not difficult or above his business?

If just stay on the level of use, I believe that any technology is not difficult, see what others do, you can also quickly get started.

Is this the ultimate goal of learning?

No, absolutely not. We need to understand the basic concept of this technology, what it is, what it is, and what its pros and cons are. I'll take you back to hibernate:


What is Hiberante?


Hibernate, translation is the meaning of hibernation, just now has entered the autumn, the world began to prepare for hibernation. In fact, for the object is persistent.

Literacy--------------------------------------------------------------------------------------------------------

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.

Methods of daily Persistence:
1, the fresh meat refrigerated, eat when the method of thawing is also.
2, the fruit can be made of the method is also.

End----------------------------------------------------------------------------------------------------------

We understand hibernate from three points of view :

Hibernate is a further encapsulation of JDBC

Originally did not use Hiberante to do persistent layer development, there are a lot of redundancy, such as: a variety of JDBC statements, connection management, so there has been hibernate to the JDBC encapsulation, we do not have to manipulate the data, directly manipulate it on the line.

Second, we'll look at it from a layered perspective.

We know a 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 of open source (Object relational mapping ) Framework .

ORM, or Object-relational Mapping, is a 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).

The core of Hibernate:

From there, we can see the six core interfaces of Hibernate, two main profiles, and their direct relationships. All of Hibernate's content 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 Hibernate

2, Sessionfactory interface: responsible for initializing hibernate

3. Session interface: CRUD Operations for persistent objects

4. Transaction interface: Responsible for business

5, query interface and the criteria interface: responsible for the implementation of various database queries

Note: The configuration instance is an object during startup, and once Sessionfactory is created it is discarded.

Advantages/Disadvantages of hiberanate:

Advantages:

1. More Object

With the object-based thinking operation database, we only need to manipulate the object to be able, the development is more object-based.

2. Transplant Sex
Because Hibernate does a persistent layer of encapsulation, you don't know the database, and all of 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.

The action and actionform of struts need to be inherited, without struts. 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.

Disadvantages:

1, using the database characteristics of the statement, it will be difficult to tune

2, there are problems in large-scale data update

3, there are a lot of attack query function in the system

 
Summarize:

Hibernate allows us to use an object-oriented mind-manipulating relational database. The main purpose of this blog post is to understand hibernate as a whole, and may not be a bit empty, not particularly detailed, but there will be more specific posts to explain later. Please look forward to it.

Basics of "SSH Advanced path" hibernate

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.