Object-Relational mapping (English: Objects Relation Mapping, abbreviated ORM, or O/RM, or O/R Mapping) is a program technology that enables the conversion of data between different types of systems in an object-oriented programming language. In effect, it actually creates a "virtual object database" that can be used in a programming language. Object-oriented is developed from the basic Principles of software engineering (such as coupling, aggregation, encapsulation), and the relational database is developed from the mathematical theory, and the two sets of theories have significant differences. In order to solve this mismatch, object-relational mapping technology emerged. Object Relational Mapping (Object-relational Mapping) provides conceptual, easy-to-understand methods for modeling data. The ORM methodology is based on three core principles: simple: Modeling data in the most basic form. Communication: The database structure is documented in a language that anyone can understand. Accuracy: Create a properly standardized structure based on the data model. Typically, modelers develop information models by collecting information from people who are familiar with the application but are not proficient in data modelers. Modelers must be able to communicate with the data structure at the conceptual level using terminology that non-technical enterprise experts can understand. The modeler must also be able to process the sample data with simple unit analysis information. ORM is specifically designed to improve this connection. Simply put: ORM is the equivalent of relaying data. Specific to the product, such as the ADO Entity Framework. The attribute [Table] of an entity class in DLinq is considered to be a kind of relay data.
-
Software name
-
Object Relational Mapping
-
English name
-
object-relational Mapping
-
Hereinafter
-
Orm
-
Applied Disciplines
-
Software Engineering
Directory
- 1 Objects
- 2 Concepts
- 3 Products
- 4 mapping Mode
ObjectEdit-relational database Mapping rule expression ORM represents the application world as a set of objects (entities or values) that have a role (part of a relationship). ORM is sometimes referred to as a fact-based modeling because it describes the relevant data as a basic fact. These facts lose information if they are split into smaller facts. Some examples of simple facts include: people who live in a place where a person is hired at a certain date. ORM provides more than just a straightforward and straightforward way to describe relationships between different objects. The ORM also provides flexibility. Models created using ORM are more capable of adapting to changes in the system than models created using other methods. In addition, ORM allows non-technical enterprise experts to talk about models by sample data, so they can use real-world data validation models. Because ORM allows objects to be reused, the data model is automatically mapped to a properly normalized database structure. The simplicity of the ORM model simplifies the database query process. Using the ORM Query tool, users can access the desired data without having to understand the underlying structure of the database. ConceptEditObject-Relational mapping (object/relationalmapping, or ORM) is a result of the development of object-oriented software development methods. The object-oriented development method is the mainstream development method in the enterprise application development environment, and the relational database is the mainstream data storage system which is stored permanently in the enterprise-level application environment. object and relational data are two representations of business entities, and business entities behave as objects in memory and behave as relational data in the database. There are associations and inheritance relationships between objects in memory, and in a database, relational data cannot directly express many-to-many associations and inheritance relationships. Therefore, object-relational mapping (ORM) system usually exists in the form of middleware, which mainly realizes the mapping of program object to relational database data. Object-oriented is developed from the basic Principles of software engineering (such as coupling, aggregation, encapsulation), and the relational database is developed from the mathematical theory, and the two sets of theories have significant differences. In order to solve this mismatch, object-relational mapping technology emerged. Let's start with the O/R. The letter O originates from the object, and R is derived from the relationship (relational). In almost all programs, there are objects and relational databases. In the business logic layer and the user interface layer, we are object-oriented. When the object information changes, we need to keep the object's information in the relational database. When you develop an application (do not use O/R MAPPING), you may write a lot of data access layer code to save, delete, read object information from the database, and so on. You wrote a lot of ways to read object data, change state objects, and so on in the Dal. And the code is always repeating itself. If you open your recent program and look at the DAL code, you will definitely see a lot of approximate generic patterns. As an example of how to save an object, you pass in an object, add SqlParameter to the SqlCommand object, correspond all the properties and objects, set the CommandText property of the SqlCommand to the stored procedure, and then run SqlCommand. Write the code repeatedly for each object. Besides, is there a better way? There, introduce a O/R MAPPING. Essentially, an O/R mapping will generate a DAL for you. Instead of writing the DAL code yourself, use the O/R MAPPING. You use O/R mapping to save, delete, read objects, O/R mapping is responsible for generating SQL, you just need to care about the object just fine. Object Relational mapping is successfully applied in different object-oriented persistence layer products, such as: Torque,ojb,hibernate,toplink,castor JDO, TJDO, etc. The general ORM consists of the following four parts: a crud operation on a persistent class objectAPI; A language or API used to specify queries related to class and class attributes; A tool that prescribes mapping metadata; a technique that enables an ORM implementation to dirtychecking with a transactional object, LAZY Association Fetching and other optimization operations. Products edit Many vendors and open source communities provide the implementation of a durable layer framework, common to: Java series: APACHE ojbcayennejaxorjpahibernateibatis/ Mybatisjrelationalframeworksmyletoplink where TOPLINK is ORACLE's commercial product, others are open source projects. Hibernate's lightweight ORM model gradually establishes the leading position in the Java ORM Architecture, and even replaces the complex and cumbersome EJB model as the de facto Java ORM Industry standard. And many of these designs have been absorbed by the Java EE Standards Organization and become the standard of the latest EJB 3.0 specification, which is also a strong testimony of the open source project affecting industry standards. NET series: Entityscodegeneratelinq Tosqlgroverungoo. Enterpriseormfirecode creatormygenerationcodesmith Procodeauto ... Where: entityscodegenerate: Yes (vb/c#. NET Entity code generation tool), Entityscodegenerate (ECG) is a special for. NET database program to develop a tailored (ORM framework) code generation tool that generates program code based on object-oriented, hierarchical architecture, ORM and Reflection + Factory mode. Support. NET1.1 and above, available for Oracle, SQL Server, SYBASE, DB2, MYSQL, ACCESS, SQLITE, POSTGRESQL, DM (Dream), PowerDesigner files, INFORMIX, FIREBIRD, MAXDB, Excel, and OLE DB, ODBC connected databases can be customized, see the tool's help documentation and examples. LINQ to SQL: Microsoft provides SQL Server database, a component of the. NET FRAMEWORK version 3.5, that provides a run-time infrastructure for managing relational data as objects. Grove: GROVE ORM Development TOOLKIT. Contains two parts of Grove and Toolkit. Grove provides the ORM with object persistence, relational object query, simple transaction processing, simple exception management and other functions. Rungoo. Enterpriseorm: is a code generation tool based on enterprise application architecture, which is mainly applicable to B/S model Application system development. Development language: C #, support for VS2003 and VS2005 two versions of the development platform, whileSupports SQL server2000/2005. The Wind code generator [Firecode CREATOR] is a commercial sharing program code generation software based on a variety of databases that can be quickly established: Add, edit, view, list, search functions. Supported databases: database connections such as SQL SERVER, ACCESS, ORACLE, MYSQL, EXCEL, FOXPRO, FOXBASE, text, and so on. Mapping mode edit From the "public warehouse meta-model: Development Guide," the 8th chapter of the CWM meta-warehouse extracts from the content, the implementation of the public warehouse meta-model (CWM) UML diagram to the Microsoft SQL Server database mapping, is a way to map the object hierarchy into a relational structure. Personally, it can be used as a reference method to store ontology (ONTOLOGY) files in relational database. Basic situation: The public warehouse meta-model (CWM) is an object management organization (OMG) and data Warehouse-related meta-model standards, the use of UML-represented object hierarchy, when saved to the database due to the imperfect object-oriented database technology (theoretical research and business applications are not mainstream), So the author of the book tends to use a mature relational database to save-this is also the problem of storing the ontology. Adoption method: The UML model of the various elements through the transformation, save as a database schema. Because Cwm is a meta-model, an instance of the model is also a model that saves this instance as database data. Improve development and execution efficiency with more mature stored procedure technologies in the database. 1. Data type mapping mode 1.1 simple data type pattern: build a mapping table of simple data types in UML and relational databases to guide mapping. 1.2 Enumeration data type pattern: One table for each enumeration type, and only one column (_enumliteral) represents the enumeration value. 1.3 Class-based data type pattern: Use a FOREIGN KEY constraint to associate the underlying column with a class-based type instance. 2. class map model Each class corresponds to a table. Single-valued, multivalued, and inherited relationships can be mapped in the following ways, whereas reference properties are mentioned in the associative mapping pattern. 2.1 Single-valued attribute mode: A property with an upper bound of cardinality of 1, mapped to the column of the table corresponding to the class. If the lower bound is also 1 (Required property), the column property is not NULL. 2.2 Multivalued attribute pattern: Each multivalued attribute is mapped to a separate table, and the foreign key is used to connect to the table corresponding to the class. 2.3 Inheritance mode: Every time an instance of a class is added, the object of each class is generated from top to bottom according to its inheritance, and the objects have the same ID (the primary key of the corresponding record for the root object). When you delete an object instance, the data is deleted from the bottom up. What do I do if I delete from the middle? How does multiple inheritance work? (Golden Dragon Fly) 3, association mapping mode 3.1 one-to-two correlation mode: Add a column at each end of the association. 3.2 One-to-many correlation modes: Same as 3.1. If more of this end is ordered, you also need to add a column to indicate the ordinal. 3.3 Many-to-many correlation patterns: separate the associations into a single table. 3.4 Combined correlation mode: note cascading deletes. 3.5 Inversion Correlation Pattern: The association ends up pointing to the related type, as is the normal association. 3.6 Paired Correlation Patterns: Association records the relationships between two classes, representing associations with the intersection class, representing a single table, one table per association, and a foreign key representationThe relationship between them. The OCL on the 3.7 association needs to be parsed into the corresponding stored procedure code. 3.8 Ensure that the associated cardinality also needs to be parsed into the corresponding stored procedure code. 4. A MOF feature that references a mapping pattern that does not exist in UML, which refers to an instance of a property declared as a reference type. Implemented with stored procedures. Operational RISK MANAGEMENT
Object Relation Mapping ORM