Java three framework hibernate part knowledge

Source: Internet
Author: User

1, three layer architecture
Presentation Layer Web layer (MVC is a design model of a presentation layer)
Business Layer Service Layer
Persistence Layer DAO Layer
2. The relationship between the three frameworks and the three-tier architecture (it is recommended to learn the order of the three frameworks: Learning Hibernate before learning STRUTS2 framework and finally learning Spring framework)
Hibernate framework: It is a persistent layer framework
Struts2 Framework: It is a presentation layer framework
Spring Framework: It is a comprehensive class framework

Hibernate can only manipulate databases (dealing with databases)

3. The persistence layer technology already mastered at this stage
JDBC: It's the bottom-up way of manipulating a database.
Advantage: Lower level, high efficiency.
Cons: When writing code, more cumbersome. In particular, encapsulate the result set.

Dbutils: It is based on JDBC and has a simple encapsulation of JDBC.
Advantage: Encapsulating The result set is easy. And still write the SQL statement yourself, the relative efficiency is not much affected.
It uses the mind of the pool to manage the connection.
Cons: Requires that the name of the attribute in the entity class and the field name of the database table must be identical.
We have a lot of things to remember.

What they have in common: we have to write our own SQL statements.

4.hibernate Realization Idea:

Establish relationships between entity classes and tables
         use configuration files.
         configuration file types:
             Properties
            xml
         Choose Properties or XML?
             using XML.
             Because XML can describe hierarchical relationships
     The configuration file example of the corresponding relationship:
        <class name= "class name" table= "table name";
             <id name= "entity class Property name" Column= "The primary key field name in the table";
             <property name= "property name" column= "Field name in table"/>
        </class>
        insert into  $tablename $ ($columnname $, $columnname $) VALUES ( PRODUCT.GETXXX,PRODUCT.GETXX)

5.ORM
Object Relational Mapping
Object Relational Mapping
is to establish the corresponding relationship between the entity class and the database table.
Implementing an Action entity class object is equivalent to manipulating a database table
6. Hibernate
It is a lightweight, enterprise-class, open-source ORM Persistence layer framework. is the framework in which the database can be manipulated.
Framework: It is a schema.
Typically, the software engineering of a durable layer solution, a primary one supplemented. Both coexist (write SQL statements and do not write SQL statements)
Lightweight: Refers to the few resources that are dependent on the use. (Currently we are using a phase that relies only on the LOG4J,C3P0 connection pool)
Enterprise-level: Refers to the more used in enterprise applications
Open Source: OpenSource.
ORM operation mode: Establish object relation mapping, implement operation entity class is equivalent to manipulate database table.

Common objects for 7.hibernate
Configuration
Sessionfactory
Session
Transaction

Java three framework hibernate part knowledge

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.