Object link ORM ing orm, object ing ORM

Source: Internet
Author: User
Tags relational database table

Object link ORM ing orm, object ing ORM

 

1. Object link ORM ing ORM Overview
 

Object-Relational ing (ORM) is a technology designed to solve the problem that the object-oriented model of a program does not match the Relational model of a database. To put it simply, ORM uses metadata that describes the ing between objects and databases (XML or annotations can be used in Java ), automatically persists objects in a program to a relational database or converts rows in a relational database table to a Java object. In essence, the data is converted from one form to another.

The most important concept in the ORM process is Mapping. This ing can be used to separate business objects from databases. From the object-oriented perspective, the database should not be bound with the business logic, and the orm plays a role in this separation, so that the database layer is transparent and developers are truly object-oriented.

It briefly describes the role of ORM in multi-layer system architecture.

(Picture from www.shsxt.com)

Currently, most projects or products use relational databases to store business data. In this way, some business logic needs to be directly implemented using SQL statements during development, however, the result of this development is that SQL statements are everywhere. These highly-coupled SQL statements pose many unpredictable obstacles to System Transformation and upgrade. To improve project flexibility, especially rapid development, ORM is a good choice. For example, in An ORM system, when the database model changes, you do not need to ignore all the changes involved in the logical code and SQL statement, you only need to make slight changes to the objects mapped to the model.

Picture from network (Shanghai shangxuetang)

Ii. ORM features and advantages and disadvantages 1. ORM features

1. Improved development efficiency. Since ORM can automatically map fields and attributes of Entity objects to tables in the database, we may no longer need a dedicated and huge data access layer.
 
2. ORM provides database ing and can get data from the database just like an operating object without the need for SQL code.
 

2. Advantages and Disadvantages of ORM

The disadvantage of ORM is that it sacrifices the execution efficiency of the program and sets the Fixed Thinking Mode.
From the perspective of the system structure, the ORM-based systems are generally multi-layer systems. If there are more layers of systems, the efficiency will be reduced. ORM is a completely object-oriented approach, and the object-oriented approach will also have a certain impact on performance.

Generally, performance problems occur during system development. Performance problems are mainly caused by incorrect algorithms and incorrect database usage. The code generated by ORM is generally not likely to write very efficient algorithms. It is more likely to be misused in data library applications, mainly reflected in the extraction of persistent objects and data processing, if ORM is used, the programmer may extract all the data to the memory object, and then filter and process the data. This will easily lead to performance problems.
 
During Object persistence, ORM usually persists all attributes. Sometimes, this is not desired.
However, ORM is a tool that can solve some repetitive and simple tasks. This is undeniable. However, we cannot expect tools to solve all the problems once and for all. Some problems still need special processing, but some of the systems that need special processing should be very few.

Thank you for reading the Shanghai shangxuetang article. For more articles or technical support, please clickJava training in Shanghai

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.