'Hibernate full Manual' Reading Notes (1) Object Persistence Basics

Source: Internet
Author: User

Database technology has become the core of the enterprise information platform. ApplicationProgramThe business-related data must be persisted to the database in a certain way, and the existing data should be obtained from the database and provided to the customer or support system in an appropriate form.

Key points: How to efficiently access data, simplify programming models, and reduce application complexity

The persistence layer is introduced in the system, which is responsible for the persistence of all relevant data and provides a high-level, unified, secure, and concurrent data persistence mechanism for the entire application system.

1. Object Persistence Technology

1-1. Java object serialization
Serialization is a lightweight data persistence mechanism built in the Java language, which can implement any Java. io. the object of the serializable interface is converted to continuous byte stream data, stored in a file, or transmitted over the network. The data can be restored to the original object State in the future.
Disadvantage: the query can only return the next object of the data stream, but does not provide partial reading and updating. It does not provide object lifecycle management, but simply reads and writes data, no concurrency or transaction features are provided.

1-2. Use JDBC
JDBC (Java database connectivity) is a standard Java API used to access relational database systems. JDBC only provides interfaces for data access. Its underlying implementation is implemented by a specific database vendor.
Disadvantage: SQL statements and Applications When JDBC is directly used for persistenceCodeThe logic is chaotic. In addition, it is not object-oriented to directly use SQL to operate databases.

1-3. Use JDO
Java data object is a specification released by JCP (Java Community process) and a standard for Java object persistence. JDO only defines standard programming interfaces, and leaves the definition of link ing to software vendors for implementation.

1-4. entity EJB
Enterpise Java Bean is a standard for data persistence in the Java field.

1-5. Object relationship ing
Ojbect Relation Mapping establishes a bridge between the object model and the Relationship Model. Orm technology encapsulates the operation details of data persistence and provides an access interface for the application, so that the application can focus on the processing of business logic. It uses pojo (plain old Java object, simple traditional Object) as the expression of the domain object, does not involve technical details outside of the domain object, reduces the ORM technology intrusion, and implements simple, easy to test and highly scalable.

2. Object link ing model
A complete object relationship ing framework should have the following four aspects:

①. A metadata ing specification is used to map database tables and fields of persistence classes and class attributes to realize semantic connections between objects and relationships.
② A group of object operation interfaces for adding, deleting, modifying, and updating data.
③ An Object-Oriented Query Language that can understand the inheritance, polymorphism, association, and other object-oriented features, implement object-based query, and navigate between objects.
④. A series of technical implementation and best practices related to the database to ensure system integrity and improve system availability and scalability. For example, transactions, caches, and data capture policies.

Object Model (class, attribute, Association) <==> relational model (table, field, constraint)

 

ps.
ISBN 978-7-111-23764-8
mechanical industry press
edited by Hou zhisong Yu Zhou Zheng Huan

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.