Getting started with Hibernate (1)-Environment setup and simple example, hibernate setup

Source: Internet
Author: User

Getting started with Hibernate (1)-Environment setup and simple example, hibernate setup
I. Preface

I complained that I had to learn the framework and did not have time to take notes during this time, but I thought I had to record this knowledge. Enter the topic

1.1 Introduction to Hibernate

What is Hibernate? What is the use of Hibernate?

Hibernate is an open-source object relationship ing framework that maps java objects to relational data in the database for permanent data storage.

(In short, we all know that Java is an object-oriented language, and databases are relational-oriented. Every time we add data to a database, do we need to write SQL statements every time, CRUD, and excellent developers

They come up with a very good ing framework, object relationship ing, that is, Hibernate. Then, when you add data to an object, data is automatically added to tables in the database. Is it amazing !)

Functions of Hibernate:

1. Manage the ing between Java class objects and databases

2. Data Query

3. improve efficiency and reduce the time required for developers to process data using SQL and jdbc

4. Hibernate can map data persistence and Object Relationships

1.2 understand Hibernate

As I have said before, to learn something, first understand what it is? What is the purpose? Why?

We need to understand Hibernate. First, we need to understand the three-tier structure. We have heard of the three-tier structure. But what is the relationship between it and Hibernate?

The structure of the next three layers is briefly described here.

The three layers are divided into the presentation layer, business logic layer, and database layer.

Presentation Layer: provides an interface for interaction with users

Business logic layer: stores, updates, deletes, and queries business data in various business logics.

Database layer: stores persistent business data for management applications

Hibernate adds a persistence layer between the business logic layer and the database layer, which is separated from the business logic. In this way, the business logic layer uses the persistence layer, the persistence layer passes through the database layer.

 

Here we talk about persistence, so what is persistence?

Permanent storage of data (such as objects in memory) to a storage device is persistence. Persistence is used to store data in the memory to a relational database.

In the end, there are two types of data storage: one is short-term storage, which is stored in the memory. When you re-run the project, the data in the memory disappears, the other is permanent storage.

The theory is here.

1.2. Simple Example-Hello world

1.2.1 build the environment

Create a new java property. Here, the author's environment is Eclipse + Tomcat8.0. download the required jar package and package it here.

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.