Initial knowledge of Hibernate

Source: Internet
Author: User

For myEclipse2014 version

How to create a project to implement the import of these things.

Open myeclipse.

2 . Click Open Perspective in the upper right corner

Find this myeclipse Database Explorer. Click OK.

3. Right-click New Database Drive

4. Create a new database to link to:

5, then complete the third part of the creation directory:

6.

Select the view you want to show,

1) Show all views

2) Show default View

3) Show selected View

3)A. The database to which this link is currently available

B. for the corresponding

C. Select our newly created database:xueyuan1509b_db

You can also select Show All. In order to simplify the operation and speed up some execution efficiency, we tick this database, and this is how it is written.

D. double-click on the newly created hibernate01. start the link, or it's called the initial link.

Expand the corresponding directory as follows:

7. Create a new Java Project and fill in two packages.

Right-click Project

MyEclipse, project facets [capabilities], Install Hibernate Facet

A.

Are you sure

B.

Select a 3.3 version

C.

Next

Put the session factory under the Com.letben.dao.

D. Select to our corresponding DB Driver

E. the subsequent completion is possible.

8. The USER_TB we established before

Hibernate Reverse Engineering ...

Select Java resource files and packages

Generate the corresponding JavaBean.

For MySQL and SQL Server , this ID Generator chooses native

For Oracle Select sequece

And then next.

Click Done directly.

Insert notes for other parts of today:

Zhou Zhenyang

Tel:18701095471

QQ:390351113

Hibernate

Phase Two core ideas:

1. Oop Object-oriented programming oriented programming

2. MVC Model View Controller

3. Hibernate Core Idea Introduction

4, Hibernate to introduce the project to do a single-table curd(Increase and deletion check)

Three major frameworks

The Hibernate framework can be understood as a link to the database instead of jdbc to automatically generate the corresponding bean

The Struts framework can be understood as a substitute for the control layer servlet

The Spring framework is used to integrate the underlying framework of other frameworks

Oracle Database

Jquery is used instead of JS or js version of the upgrade

Mybaties instead of JDBC to achieve additions and deletions before and after the more new technology with hibernate is mybaties

Another set of MVC frameworks Springmvc

The application of Oop in the project

1. Find objects

2. Find Properties

3. Find a Way

Making the project process

1. Analysis of Project Flow

2, according to the process to find relevant objects

3. Properties of the Analysis object

4, the behavior of the analysis object

"Hidden objects are often not found, we need to do a lot of projects, accumulate a lot of experience"

an idea -- design pattern of MVC

the implementation of MVC: Put classes of different functions in different packages.

1. Bean entity class:pojo javabean entity domain

2. Database Operation Package

3. Servlet Package

4. Kit util or base

Business Layer Service Package

Complete business logic

Dao Persistence layer data access layer

M: model layer Bean

V: view layer

C:controller Control layer servlet Request Processing Response

Servlets are not very good for concurrent processing, big data may collapse and need to use struts action.

What are the benefits of Oop?

Pros: The Word motto: Reusable, maintainable, scalable, flexible

Expand to say inherit polymorphic package

Hibernate:

The core idea is ORM: Object-Relational mapping objects relation mapping

what does an ORM accomplish?

Hibernate realizes, uh, the one by one correspondence between the database and the entity class through Orm thought

How do I implement a correspondence relationship?

"Two ways we've learned before, *.properties and *.xml."

To implement ORM You must establish A link to the DB and the program

There must be XML configuration information for the database connection

Conclusion:Hibernate Technology realizes one by one correspondence between table and entity class. Two files must be created

1. Relationship description file . xml

2. Database connection information . XML

Genuine notes yesterday:

Target ':

Core Thought review:

1. OOP

2. MVC

3. Hibernate Core Idea Introduction ORM

4, Hibernate introduced the project to do a single table curd

(1) Course Introduction

Enterprise-level development framework

A. Hibernate frame --1 week or so instead of jdbc to do curd

B. The Struts framework --1 around the week instead of the control layer servlet for multithreading support. It's mainly action .

C. The Spring framework is responsible for the consolidation of other frameworks--3 days or so

D. Oracle--1 Week or so

E. jQuery framework --2 days or so JS 's upgraded version

F. Mybatis--2 to replace the jdbc implementation curd

G. Springmvc--2 days or so

1 weeks to do the project

(2) OOP Object oriented programming- oriented programming

Live Java Database

Class table of objects

Attribute Property / member variable field

Action method

Relationship inheritance primary foreign key Association

The application of OOP in the project:

1. Find objects

2. Find Properties

3. Find a Way

To create the project process:

(1) Analysis of project flow

(2) Find the relevant object according to the process

(3) Each object property

(4) Behavior of each object

"Sometimes I can't find it all."

2. MVC

is a programming idea / idea ---> " design pattern "

MVC implementation: Put classes of different functions in different packages

(1) Class and table one by one correspond

Beans-- entity classes,pojo,javabean, entity entities,domain

(2) Database operation package

(3) servlet package:servlet class

(4) Tools:util,base

Mvc

M:model model layer:Bean+dao

V:view View layer JSP page

C:controller Control layer servlet

Business layer:service pack!

Primarily responsible for the implementation of the business logic, theservlet invokes the service, andtheservice invokes all the DAO that the process involves .

The complete package structure is as follows:Jsp->servlet->service->dao->util

DAO layer: Also known as the persistence layer!

Concept of persistence:

(1) In-memory data saved to DB or hard disk for permanent storage

(2) From database db, read data to memory

Level: Phase Three technology

V JSP

C struts action for multi-access hosting

M Curd implements hibernate,mybatis directly generates beans

What are the benefits of OOP ?

Reusable, maintainable, expandable and flexible

Hibernate Core idea ORM

ORM Object Relation Mapping objects relational mapping

Hibernate realizes the one by one correspondence of the table and the entity class through this thought.

Conclusion:

Hibernate Technology to achieve the mapping between table and entity class one by one, you must establish 2 classes of files.

the *.hbm.xml class corresponds to the relationship description file . xml

*.hibernate.cfg.xml Database Connection configuration information . XML

Then there is the import of hibernate in front of the myeclipse .

Initial knowledge of Hibernate

Related Article

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.