16.spring+hibernate Simple Example

Source: Internet
Author: User

1. Concept

Hibernate is an open source object-relational mapping framework that provides JDBC with a very lightweight object encapsulation that maps Pojo to database tables, is a fully automated ORM framework, and Hibernate can automatically generate SQL statements Automatic execution allows Java programmers to manipulate the database using object programming thinking at will.

Hibernate objects:

①configuration (an instance of the configuration class first locates the location of the mapped document, reads the configuration, and then creates a Sessionfactory object)

②sessionfactory (a database corresponds to a Sessionfactory object)

③session (for objects that manipulate the database)

The ④transition (Transaction interface is an abstraction of the actual transaction implementation that includes JDBC transactions, usertransaction in JTA, and even CORBA transactions)

The ⑤query (query interface makes it easy to query the database and persistent objects, which can be expressed in two ways: the HQL language or the SQL statement for the local database.

The ⑥criteria interface is very similar to the query interface, allowing you to create and execute object-oriented, standardized queries. It is important to note that the criteria interface is also lightweight and cannot be used outside the session.

Through these interfaces, you can not only access persistent objects, but also enable transaction control.

Code implementation:

16.spring+hibernate Simple Example

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.