Basic principle of mapping

xiaoxiao2021-03-06  58

Original from http://www.agiledata.org/

Most of the stylish business software is developed with object languages ​​such as Java and C #, and store data with relational data inventory. Of course, this can't say that you can't have other options. There are many programs that use process languages ​​such as COBOL, and many systems use object databases or XML databases to save data. In any case, the object language is still the standard, so I assume that you are working in this case. If you are working with different storage technology, many concepts still apply, although this may be modified.

There is "impedance distraction" between object language and relational technology, and the project team is generally the basis for developing a software as a system. This can easily overcome the problem of "impedance distraction", this transmissions are two aspects: you need to understand the relationship between mapping objects to databases and mappings in a database.

1, the role of agility DBA

Figure 1: Displays the agility DBA role map to the object to the relational database. There are three main activities here to be interested in:

(1) Mapping. The basic objective of the mapping is to determine the valid policy determined for the data of a lasting object. This includes the relationship between the data attributes and objects of the individual object, and the relationship between the inheritance structure between all classes.

(2) Implement mapping.

(3) Performance adjustment.

An interesting thing is about Figure 1: Agile DBA and application developers working together on all three events. Although agile DBA is responsible for ensuring that the mapping is valid, they will not be responsible for the actual results. Other work will not act alone, this is the secret of agile software success.

2, the basic concept.

The first step in which the learning object is mapped to the database is the data properties of the object. A property in the relational database will be mapped to multiple columns. Remember, not all attributes are persisted, and the temporary calculation attributes are not available. For example, the "Student" object in your program has an "average" property, but it does not have to be saved in the database because it is calculated in the program. Some attributes are a class, a "customer" object has an "address" class as an attribute, which reflects the combination between the two classes is very likely to be mapped, and the "address" class itself must Mapped. Important things are clear definitions: The properties on some points are mapped to multiple columns.

The simplest mapping is to map a separate property to a separate column. They have the same basic type, for example: they are all types, attributes are string and column is char, or the attribute is Number and column is float.

Mapping

Mapping (V). The relationship between objects and others is persisted in a permanent data memory, and persisted in the relational database. Mapping (n). The object's properties or a relationship is persisted in a permanent data memory. Property. Data properties, any one of the implementations can be physical properties such as the "firstname" character type, or a "GetTotal ()" operation via the sum of the sum of a sequence. Property mapping. Describe the properties of the map to persistence objects. RELATIONSHIP MAPPING. Describe how to persist relationship between two or more objects (combination, polymerization, synthesis).

Some levels of mapping to data sheets are relatively simple, but not always directly. In addition to a very simple database, you will not have a pair of one-to-one class class map, which will be noticed in this chapter later about "mapping inheritance". However, a usual theme you will see in this chapter will be better for your starting mapping for a table map.

Now let us start from simple. Figure 2 depicts two models, a UML diagram, and a physical data model. Two charts are one order system description simple instance part, you can see the properties of the class can be mapped to the list of databases, give an example " The "Datafulfilled" column of the Order table is mapped to the "DataFullFilled" property of class "Order".

figure 2

The initial attribute is easily determined because several reasons are. First, named standards apply to all models, one aspect of agile modeling is applied to modeling standard practices. Second, it is very likely to build all the models by the same person. When people working in separate teams, their solution is usually changed, even if they work very well. Because their different design determines different ways. Third, a model may be driven by other models. In "Different Project Demand Different Policy" section, we discussed the development of the object instance when you develop a new project, will drive your database instance. Even if the two instances are similar to those described in Figure 2, the difference means that the mapping will not be perfect, and the differences are:

(1) There are several attributes for TAX in the object instance, and only one in the database. When the object saves the data, the three properties of the "Order" class are all accumulated and saved to the "TAX" column of the "Order" table. However, when the object is read into memory, three attributes need to be calculated.

转载请注明原文地址:https://www.9cbs.com/read-117292.html

New Post(0)