The path to growth from programmers: http://blog.csdn.net/zxc22436/article/details/6875220
Object relationship ing (ORM) provides a conceptual and easy-to-understand Method for modeling data. The ORM methodology is based on three core principles: Simplicity: modeling data in the most basic form. Communication: the database structure is documented in a language that anyone can understand. Accuracy: Create a correctly standardized structure based on the data model. Typically, modelers develop information models by collecting information from those who are familiar with the application but are not skilled in data modelers. Modelers must be able to communicate with data structures at the conceptual level with terms that non-technical enterprise experts can understand. Modelers must also be able to process sample data with simple unit analysis information. Orm is specially designed to improve this connection.
Object/Relation Mapping (ORM) is generated with the development of object-oriented software development methods. Object-Oriented development is the mainstream development method in today's enterprise-level application development environment. Relational databases are the mainstream data storage systems that permanently store data in enterprise-level application environments. Objects and relational data are two forms of business entities. business entities are represented as objects in the memory and relational data in the database. Objects in the memory have associations and inheritance relationships. In the database, relational data cannot directly express many-to-many associations and inheritance relationships. Therefore, the object-relational ing (ORM) system generally exists in the form of middleware, mainly to map program objects to relational database data. Object-Oriented development is based on the basic principles of Software Engineering (such as coupling, aggregation, and encapsulation), while relational databases are developed from mathematical theories, there are significant differences between the two sets of theories. To solve this mismatch, the object link ing technology emerged. Let's start with O/R. The letter O originated from "object", while R came from "relational ). Objects and relational databases exist in almost all programs. In the business logic layer and user interface layer, We are object-oriented. When the object information changes, we need to save the object information in the relational database. When you develop an application (without O/R Mapping), you may write a lot of data access layer code to save, delete, and read object information from the database. You have written many methods in the Dal to read object data, change State objects, and so on. These codes are always repeated. If you open your recent program and look at the Dal code, you will certainly see many similar general patterns. Let's take the method of saving objects as an example. You pass in an object, add sqlparameter to the sqlcommand object, map all attributes to the object, set the commandtext attribute of sqlcommand as the stored procedure, and then run sqlcommand. This code must be repeatedly written for each object. In addition, is there a better way? Yes. Introduce an O/R Mapping. Essentially, an O/R Mapping will generate a dal for you. It is better to use o/R Mapping than to write the Dal code by yourself. You use o/R Mapping to save, delete, and read objects. O/R Mapping is responsible for generating SQL statements. You only need to care about objects. Object relationship ing is successfully applied to different object-oriented persistence layer products, such as torque, OJB, hibernate, toplink, Castor JDO, and tjdo. A general ORM includes the following four parts: an API for performing crud operations on persistent class objects; a language or API is used to specify queries related to Class and Class attributes; A tool that defines metaing metadata. A technology allows ORM implementation to perform dirty checking, lazy Association fetching, and other optimization operations together with transaction objects.
Currently popular ORM Products
Currently, many vendors and open-source communities have provided implementation of the persistent layer framework. Common examples include: Java series: Apache OJB () Cayenne () jaxor () hibernate () ibatis () jrelationalframework () mirage () smyle () toplink () Where toplink is a commercial Oracle product, and others are open-source projects. Among them, Hibernate's lightweight ORM model gradually establishes a leading position in the Java ORM architecture, and even replaces the complex and complicated EJB model to become the de facto Java ORM industrial standard. Many of these designs have been absorbed by J2EE standards organizations and become the latest EJB 3.0 standard, which is also a strong witness to the impact of open-source projects on industrial standards.. Net series: entityscodegenerate LINQ to SQL Grove rungoo. enterpriseorm firecode creator mygeneration codesmith pro codeauto... where: entityscodegenerate: Yes (Vb/C #. NET Entity code generation tool), entityscodegenerate (ECG) is a specialized.. NET database program development (ORM framework) code generation tool. The generated program code is based on object-oriented, hierarchical architecture, Orm and reflection + factory mode. Supported. net1.1 and later versions can be used in Oracle, sqlserver, Sybase, DB2, MySQL, access, SQLite, PostgreSQL, and DM) the powerdesigner file, Informix, Firebird, MaxDB, Excel, and other databases connected to oledb and ODBC can be customized. For details, see the help documentation and examples of the tool. LINQ to SQL: A component provided by Microsoft for sqlserver database. It is a. NET Framework Version 3.5 component that provides a runtime infrastructure for using relational data as object management. Grove: The Grove ORM development toolkit. Contains Grove and toolkit. Grove provides object persistence, relational object query, simple transaction processing, and simple Exception management for Orm. Rungoo. enterpriseorm: A code generation tool based on the enterprise application architecture. It is mainly applicable to application system development in B/S mode. Development language: C #. It supports both vs2003 and vs2005 development platforms and SQL Server2000/2005. Fengyue code generator [firecode creator] is a commercial sharing program code generation software based on multiple databases. It can quickly create: add, edit, view, list, and search functions. Supported databases: SQL Server, access, Oracle, MySQL, Excel, Foxpro, FOXBASE, text, and other database connections.
Object-link ing mode
The contents extracted from Chapter 8th of "public warehouse meta-model: Development Guide" are used to implement the public warehouse meta-model (CWM) UML ing from a UML diagram to a Microsoft SQL Server database is a way to map object hierarchies into a relational structure. I personally think it can be used as a reference to store ontology files in relational databases. Basic information: the common warehouse metadata model (CWM) is an object management organization (OMG) metadata model standard related to the Data Warehouse. It adopts the object hierarchy represented by UML, because of the imperfect Object-Oriented Database Technology (neither theoretical nor commercial applications are mainstream ), therefore, the author of this book tends to use mature relational databases for storage-this is also a problem encountered when storing the ontology. Usage method: convert various elements in the UML Model and save them as the database mode. Because CWM is a metadata model, the instance of the model is also a model that stores such instances as database data. Improve development and execution efficiency by using mature stored procedures in databases. 1. Data Type ing mode 1.1 simple data type mode: Create a ing table for simple data types in UML and relational databases to guide ing. 1.2 enumeration data type mode: Each Enumeration type corresponds to a table, and only one column (_ enumliteral) represents the enumeration value. 1.3 class-based data type mode: use foreign key constraints to associate basic columns with class-based type instances. 2. The class ing model corresponds to a table for each class. Single-value attributes, multi-value attributes, and inheritance relationships can be mapped using the following methods, and referenced attributes are described in the associated ing mode. 2.1 single-Value Attribute mode: it is the attribute with the upper bound of cardinality 1, which is mapped to the column of the table corresponding to the class. If its lower bound is also 1 (mandatory), the column attribute is not null. 2.2 multi-value attribute mode: Each multi-value attribute is mapped to an independent table, and a foreign key is used to connect to the table corresponding to the class. 2.3 inheritance mode: When a class instance is added, the class objects are generated from top to bottom based on their inheritance relationships. These objects have the same ID (the primary key of the root object corresponding to the record ). When deleting an object instance, data is deleted from the bottom up. What should I do if I delete data from the center? How to deal with multi-inheritance? (Jin longfei) 3. Association ing mode 3.1 one-to-one association mode: Add a column to each end of the association. 3.2 One-to-Multiple Association mode: Same as 3.1. If multiple ends are ordered, you must add a column to indicate the sequence number. 3.3 Multi-to-Multi-join mode: Separate the join table. 3.4 combined Association mode: Pay attention to cascading deletion. 3.5 reverse Association mode: The types at the two ends of the Association point to the correlation type, which is the same as the common association. 3.6 paired Association mode: The Association records the relationship between two classes, and uses the intersection class to indicate Association, representing a separate table. Each association corresponds to a table, foreign keys are used to represent the relationships between them. 3.7 The associated OCL needs to be analyzed into the corresponding stored procedure code. 3.8 Ensure that the associated cardinality needs to be analyzed into the corresponding stored procedure code. 4. mof features that do not exist in the reference ing mode in UML are declared as reference type instances. Use stored procedures.