Hibernate Object Persistence Framework

Source: Internet
Author: User
Tags driver manager

JDBC: (Java data Base Connectivity)Java database connection

The java.sql package provides the JDBC API, which allows you to write program code that accesses the database. Common interfaces and classes include the following:

    • DriverManager: Driver Manager, responsible for creating database connections
    • Connection: representing the database connection
    • Statement: Responsible for executing SQL statements
    • PreparedStatement: The ability to execute SQL statements with predefined SQL statements
    • ResultSet: Query result set on behalf of SQL query statement


Hibernate (Java Object Persistence Technology):Hibernate is an open-source Object-Relational mapping framework that provides JDBC with a very lightweight object Encapsulation that allows Java programmers to manipulate databases at will using object programming thinking . Hibernate can be applied to any JDBC application, both in Java client applications and in servlet/jsp Web applications, and most revolutionary of all, hibernate can replace CMP in the EE architecture of the EJB application. The task of achieving data persistence.

Hibernate has a total of 6 core interfaces: Session, Sessionfactory, Transaction, Query, criteria, and configuration.
Session Interface: is responsible for executing the persisted object crud operation The task of CRUD is to complete the communication with the database, which contains many common SQL statements. )。 However, it is important to note that the session object is non-thread-safe. At the same time, Hibernate's session differs from the HttpSession in JSP applications. When the term "session" is used, it is actually referring to the session in Hibernate, and later the HttpSession object is called the user session.

< Span style= "Color:rgb (51,51,51)" >sessionfactory interface: responsible for initializing hibernate
Transaction interface: is an optional API that allows you to choose not to use this interface instead of the underlying transaction code written by Hibernate's designers themselves. Transaction interface is an abstract
Query interface: It allows you to make queries to databases and persistent objects conveniently , and it can be expressed in two ways: the HQL language or the SQL statement of the local database. Queries are often used to bind query parameters, limit the number of query records, and ultimately perform query operations.

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

Configuration Interface: The function is to configure Hibernate and start it. During Hibernate startup, an instance of the configuration class first locates the location of the mapped document, reads the configuration, and then creates a Sessionfactory object. Although the configuration interface plays only a small role throughout the Hibernate project, it is the object that you encounter when you start hibernate.

Hibernate Object Persistence Framework

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.