Technology for data migration in large projects. Comparison of mapping with VLOOKUP(). Terms and Definitions

Port mapping- this is the redirection of received data in such a way that data received on some port of one computer is automatically redirected to some other port of another computer.

In fact, this is much easier to technically implement than to explain the principle itself. This can be compared to a sunbeam: if you direct a beam of light into a mirror, it is “automatically” reflected and illuminates an object. Moreover, if you illuminate a person and this person does not know that the beam was reflected from the mirror, he will think that the light comes from the place where the mirror is located. It’s the same here: all the data you transmit is transferred without any distortion to another computer, which can be located anywhere.

This technology is somewhat similar to a proxy server, but it is much simpler and much less flexible.

The scheme is approximately the same as when using a proxy (we can say that port mapping similar to proxy - but it will be the same. What can I say, “a grandfather looks like a grandson” - actually, this is just a proxy similar to port mapping):

Your computer >>> computer with port mapping >>> remote server.

Why do you need port mapping?

  1. If your organization uses a corporate proxy, then by configuring port mapping on it to an external mail server (mail.ru), you can use any mail program from within the corporate network - and you do not need to install/configure any additional programs!
  2. In exactly the same way as an email program, you can configure almost any other program! If only it supported TCP/IP.

Of course, these are only the main ways to use port mapping. There are many other types of activities where it will also be very, very useful.

Benefits of port mapping

  1. This system is very simple and is available on the Internet many programs, allowing to implement this function;
  2. Since the data is transmitted 100% without any distortion, you are guaranteed 100% anonymity;
  3. If you use this system, you don't need any "soxifiers" - since no additional connection initialization is required, connecting to a port mapper is equivalent to connecting to a remote computer.

Disadvantages of port mapping

  1. This system is not flexible. Unlike a proxy, where you can connect to many sites through one proxy, you can connect through one port mapping to only one server.
  2. For each new port mapping, you need to change the settings on the server where this function is implemented - this is not available from the client computer.
  3. In the Internet No free port mappers (due to their extreme limitations - one port mapping gives access to only one server), so if you want to be truly anonymous on your computer, you need to have a server somewhere on which a port mapping program will be installed - and now the address of this server will “shine” in the website logs.

How to work with port mapping

Please note that the scheme for working with port mapping is approximately the same as when working with a proxy, only even simpler. Port mapping is an alias (additional name) for the computer on which it is configured.

Let's assume that port mapping is done:

192.168.1.255:1234 => www.mail.ru:80 (port 80 is the port web servers)

Then, in order to open the mail.ru website, you can use 2 methods - open the website in a browser window:

  1. http://www.mail.ru
  2. http://192.168.1.255:1234/
    (V in this case be sure to write http://)

I would like to note: if you need to use port mapping, then you should only use the second address. That is, if you cannot connect to mail.ru, then you should only use internal address

(http://192.168.1.255:1234/).

Port mapping on local computer

  1. In the case when you are doing port mapping on your own computer, you usually indicate: local port - local port on your computer, to which you will need to connect to using port
  2. mapping. This number can be anything (from 1 to 65535), preferably more than 1000; remote host - that computer (host), on which
  3. specifies port mapping. For example, this could be the mail server pop.mail.ru; remote port - computer port,

to which The connection will occur via port mapping. For receiving mail (POP3) this is usually port 110, for sending mail (SMTP) - port 25, for web servers (www...) - this is usually port 80. So, in this case you need (by setting up port mapping) to connect

Not

to mail.ru (and the like), and specify your own computer as the server: 127.0.0.1:localport where localport is

port number http://127.0.0.1:1234/

If you are setting up mail, then as mail server please indicate 127.0.0.1 - both for receiving and sending mail. And don't forget to find the port number settings (POP3 and SMTP) in your mail client and change them in accordance with your settings in port mapping!

Replaced classes must declare a primary key column in the database table. Most classes must also declare their own JavaBeans-style properties, including a unique entity identifier. Element in the mapping file they will define the mapping of this unique field to the table column, which acts as the primary key.

(5)

(1)

name (optional): The name of the identifier property.

(2)

type (optional): A name defining the Hibernate type of the property.

(3)

column (optional - default property name): The name of the primary key column.

(4)

unsaved-value (optional - defaults to null): An identifier property value that indicates that the instance is new (in persistent storage terms).

(5)

Distinguishes this instance from transit instances that were loaded or saved in a previous version. access (optional - defaults to property): This is the strategy Hibernate will use to access this property

object. If name attribute

is not specified, it is assumed that the class does not have an identifier property.

The unsaved-value attribute is important! If your class's default id property is not null, you must set the "unsaved-value" attribute to the appropriate value. There is an alternative announcement

to access legacy data with composite keys. We strongly discourage the use of composite keys in other cases.

5.1.4.1. generator Required child element "a defines a Java class used to generate unique identifiers for instances of pesistent classes. If necessary, the element

To pass initialization or configuration parameters for a generator instance. uid_table

next_hi_value_column

All generators implement the net.sf.hibernate.id.IdentifierGenerator interface. It's a very simple interface; many applications may use their own custom generator implementation. Despite this, Hibernate includes many built-in generators. Below are short names (labels) for the built-in generators:

generates identifiers of type long, short, or int that are unique only when no other processes are adding data to the same table. Do not use in a cluster.

identity

Supports identity columns in DB2, MySQL, MS SQL Server, Sybase and HypersonicSQL. The return identifier type is long, short, or int.

sequence

Uses a sequence in DB2, PostgreSQL, Oracle, SAP DB, McKoi or a generator in Interbase. The return identifier type is long, short, or int.

hilo

Uses the hi/lo algorithm to efficiently generate identifiers that are of type long, short or int, requiring a table and column name (by default hibernate_unique_key and next_hi, respectively) as the source of hi values. The hi/lo algorithm generates identifiers that are unique only to separate bases data. Do not use this generator for JTA connections or custom connections.

seqhilo

uses the hi/lo algorithm to generate identifiers of type long, short or int, using a database sequence.

uuid.hex

Uses a 128-bit UUID algorithm to generate string identifiers that are unique within the network (using an IP address). UUID is a 32-character string containing the hexadecimal representation of the number.

uuid.string

uses the same UUID algorithm, but the string when using this generator consists of 16 (some) ANSII characters. Do not use with PostgreSQL.

native

selects identity, sequence or hilo, depending on the capabilities of the database being used.

assigned

provides the application with the ability to independently set the object identifier before calling the save() method.

foreign

the identifier of another, associated object is used. Typically used in transactions with association by primary key.

5.1.4.2. Hi/Lo algorithm

The hilo and seqhilo generators provide two alternative implementations of the hi/lo algorithm, the preferred approach for generating identifiers. The first implementation requires a "special" table in the database to store the next "hi" value. The second implementation uses sequence (Oracle-style) in databases that support them.

hi_value next_value 100 hi_value 100

Unfortunately, you cannot use hilo when supplying your Connection to Hibernate, nor can you use it in a configuration where Hiberante uses a JTA-managed application server data source. Hiberante should be able to receive the "hi" value in a new transaction. Standard approach in EJB, is to use a session stateless bean to implement the hi/lo algorithm.

5.1.4.3. UUID Algorithm

Don't try to use uuid.string in PostgreSQL.

5.1.4.4. Sequences and identity columns

You can use the identity key generator for databases that support indentity columns (DB2, MySQL, Sybase, MS SQL). For databases that support sequences, you can use the sequence style to generate keys. Both of these strategies require two SQL queries to insert a new object into the database.

uid_sequence

To develop cross-platform applications, use the native strategy. It will use identity, sequence and hilo strategies depending on the capabilities of the database with which it is connected. this moment time Hibernate is running.

5.1.4.5. Defined IDs

If you want the application to assign IDs itself, you can use the assigned generator. This special generator uses IDs that are set by the application. To do this, the application sets the identifier to the corresponding property of the object. Be very careful when using this feature to set keys (in most cases this decision signals poor application design).

Due to its inherent nature, entities that use this generator cannot be saved via the Session.saveOrUpdate() method. Instead, you must explicitly tell Hibernate whether the object should be created or updated by calling the appropriate Session object methods: save() or update().

5.1.5. composite-id

......

For tables with composite keys, you can expose multiple class properties as object identification properties. Element accepts property mappings using child elements And .

Your persistent class must override the equals() and hashCode() methods to implement composite identifier equivalence. It must also implement the Serializable interface.

Unfortunately, the ability to specify composite identifiers implies that the persistent object is the identifier. There is no possibility for convenient processing than through the object itself. You must create a persistent class entity yourself and set its identifying property before loading() the persistent state associated with that composite identifier. We'll describe a more appropriate way, where composite identifiers are implemented as a separate class, in Section 7.4, “Components as Composite Identifiers.” The attributes that are described below are only applicable to the alternative method:

    name (optional): A component type property that contains a composite identifier (see next section).

    class (optional, by default the property type is determined through reflection): the component of this class is used as a composite identifier (see the next section).

    unsaved-value (optional, defaults to none): If set to any, this indicates that transit entities are treated as new.

5.1.6. discriminator

Element needed for polymorphic persistence using the table-per-class-hierarchy mapping strategy. This element declares a discriminator column, which is used to determine whether a table entry corresponds to a specific class in the hierarchy. The discriminator can be one of the following types: string, character, integer, byte, short, boolean, yes_no, true_false.

The corresponding discriminator column values ​​for each class are specified in the discriminator-value attribute for the elements And .

The force attribute is only useful if the table contains records with additional discriminator values ​​that do not appear in the persistent class. Typically this attribute is not used.

5.1.7. version (optional)

Element reflects that the table contains version-tagged records. This is especially useful if you plan to use long transactions(see below).

(1)

column (optional, defaults to property name): the name of the column that stores version numbers.

(2)

name: The name of the persistent class property.

(3)

type (optional, defaults to integer): The type of the version property.

(4)
(5)

unsaved-value (optional, defaults to undefined): A version property value that indicates that the entity has not yet been saved (unsaved). Do not confuse unsaved entities with transit entities that were saved or loaded in a previous session. (undefined indicates that the identifier value will be used.)

Version numbers can be of type long, integer, short, timestamp or calendar.

5.1.8. timestamp (optional)

Element indicates that the table contains records marked with a timestamp. This element acts as an alternative to version markers. Timestamps are by definition a less secure implementation of optimistic locking. However, sometimes an application uses timestamps for other purposes

(1)

column (optional, defaults to property name): The name of the column that contains the timestamp.

(2)

name: The JavaBeans-style name of the Date or Timestamp property of the persistent class.

(3)

access (optional, defaults to property): The strategy that Hibernate should use to access the value of a property.

(4)

unsaved-value (optional - defaults to null): A time property value that indicates that the entity has not yet been saved (unsaved). Do not confuse unsaved entities with transit entities that were saved or loaded in a previous session. (undefined indicates that the identifier value will be used.)

Note: element is equivalent to the element .

5.1.9. property

Element Declares a persistent, JavaBeans-style property of a class.

(1)

name: The name of the property, starting with a lowercase letter.

(2)

column (optional, property name is substituted by default): the name of the corresponding column in the database table.

(3)

type (optional): The name of the Hibernate type.

(4)

update, insert (optional, defaults to true) : indicates that the corresponding column should be included in the SQL UPDATE and/or INSERT statements. Setting both properties to false allows the value of that property to be set either from another property that is displayed in the same column/columns, via a trigger, or by another application.

(5)

formula (optional): An SQL expression that calculates the value of the property.

(6)

Calculated fields should not be mapped to a database table column.

access (optional, defaults to property): The strategy that Hibernate should use to access the value of a property.

    The name of the Hibernate base type (for example, integer, string, character, date, timestamp, float, binary, serializable, object, blob).

    Java class name (for example, int, float, char, java.lang.String, java.util.Date, java.lang.Integer, java.sql.Clob).

    The name of a class derived from PersistentEnum (for example, eg.Color).

    The name of the Java class to be serialized.

    The name of the custom class (for example, com.illflow.type.MyCustomType).

If you do not specify a value for the type property, Hibernate will use reflection on the specified property to guess the appropriate Hibernate type. Hibernate will try to determine the class name of the returned property using get() using rules 2, 3, 4 in that order. However, this is not always enough. In some cases, you still need to specify the type attribute. (For example, to differentiate between Hibernate.DATE and Hibernate.TIMESTAMP, or to specify a custom type.)

The access attribute allows you to control how Hibernate accesses a field at runtime. By default, Hibernate calls get/set methods to access a field. If you specify access="field" then Hibernate will bypass the get/set methods and access the field directly using reflection. You can specify your own access strategy by specifying a class that implements the net.sf.hibernate.property.PropertyAccessor interface.

5.1.10. many-to-one

A normal relationship with another persistent class is declared using the many-to-one element. In relational terms, it is a many-to-one association. It's really just a reference to an object.

(1)

name: Property name.

(2)

column (optional): Column name.

(3)

class (optional - by default, the field type is determined through reflection): The name of the associated class.

(4)

cascade (optional): Specifies which operation will cascade from the parent object to the associated object.

(5)
(6)

update, insert (optional - true by default) determines that the displayed columns will be included in SQL UPDATE and/or INSERT queries. Setting both properties to false allows the value of that property to be set either from another property that is displayed in the same column/columns, via a trigger, or by another application.

(7)

property-ref: (optional) The name of the key property of the associated class. This property will be used to bind. If not specified, the primary key of the associated class is used.

(8)

access (optional - defaults to property): The strategy that Hibernate uses to access the value of a given field.

The cascade attribute can take the following values: all, save-update, delete, none. Setting a value other than none will entail certain operations on the associated (child) object. See "Object Life Cycle" below.

The outer-join attribute can take the following three values:

    auto (default) retrieves associated objects using outer join if the associated class does not have a proxy.

    true Always retrieve associated objects using outer join.

    false Never retrieve associated objects using outer join.

A typical many-to-one association declaration looks like this

The property-ref attribute is used only for linking with inherited data when the foreign key refers to a unique value of the associated table other than the primary key. This is a dangerous relational decision. For example, it is possible that the Product class has a unique sequence number that is not the primary key. (The unique attribute controls Hibernate's DDL generation. Generation is done using the SchemaExport utility.)

The mapping for OrderItem can use:

In fact, doing this is highly discouraged.

5.1.11. one-to-one

A one-to-one association with another persistent class can be declared using the one-to-one element.

(1)

name: Property name.

(2)

class (optional - by default determined by reflection based on the field type): The name of the associated class.

(3)

cascade (optional) specifies which operation will be cascaded from the parent object to the associated object.

(4)

constrained (optional) specifies that a foreign key referencing a table of the associated class is constrained by that table's primary key. This option affects the order in which the save() and delete() cascade operations are performed (and is also used by the schema export tool).

(5)

outer-join (optional - defaults to auto): Enables retrieval of associated objects using outer-joins if the hibernate.use_outer_join configuration file option is enabled.

(6)

property-ref: (optional) The name of the property of the associated class that is included in the primary key of this class.

(7)

If not specified, the primary key of the associated class is used.

There are two types of one-to-one associations:

    primary key relationship

    relationship using a unique foreign key

To organize an association using a primary key, there is no need for additional columns; If two records are related by such an association, it means that two records in two tables have the same primary key value. Therefore, if you want to associate two objects so that they are related by a primary key, then you must make sure that their IDs are set to the same value!

For a primary key association, add the following mapping for the Employee and Person classes, respectively.

Now we need to make sure that the primary keys of the related records in the tables are identical. We use a special Hibernate foreign generator:

employee ...

The persisted instance of the Person class is assigned the same primary key value that is assigned to the instance of the Employee class referenced by the employee property of the Person class.

As an alternative to describing the one-to-one relationship from Employee to Person through a unique foreign key, you can use the following notation:

This association can be made bidirectional by adding the following expression to the mapping of the Person class:

5.1.12. component, dynamic-component

Element maps the fields of a nested object to the table columns of the parent class. Components can in turn define their own properties, components, or collections. See "Components" below.

(5) ........

(1)

name: The name of the property (referring to the component object).

(2)

class (optional - by default the component type is determined using reflection): The name of the component class.

(3)

insert: If set to true, the component's displayed fields participate in SQL INSERT queries.

(4)

update: If set to true, the component's displayed fields participate in SQL UPDATE queries.

(5)

access (optional - defaults to property): The strategy that Hibernate should use when accessing this bean through its parent object.

Nested tags Map component fields into table columns.

Element allows nested element Which renders the component property as a back reference to the parent object.

Element allows you to use a Map as a component in which the field names correspond to the Map's keys.

5.1.13. subclass

Finally, polymorphic persistence requires every subclass of the base class to be declared. For the (recommended) display strategy, table-per-class-hierarchy uses the element .

.....

Each subclass must declare its own persistent fields and subclasses. Inheritance of properties is allowed And from the base class. Each subclass in the hierarchy must define a unique discriminator-value. If this value is not specified, the full class name is used as the discriminator.

5.1.14. joined-subclass

Alternatively, a subclass whose objects are stored in a separate table (table-per-subclass mapping strategy) is declared using the element .

.....

This display strategy does not require the discriminator column to be specified. However, each subclass must declare a table column that contains the identifier to be displayed by the element . The mapping given at the beginning of the section can be rewritten as follows:

The persistent state consists of references to other entities and instances of value types. Values ​​are primitives, collections, components, and other immutable objects. Unlike entities, value type instances (particularly collections and components) are persisted and deleted when available. Because value type objects (and primitives) are stored and deleted along with their containing entity, they cannot have independent versioning. Values ​​also do not have an independent identity and thus cannot be shared between two entities or collections.

All types in Hibernate, with the exception of collections, support null pointer semantics.

Up to this point, we have used the term "persistent class" to refer to entities. We will continue to do this. Strictly speaking, not all user-defined classes with persistent state are entities. For example, a component is a user-defined class with value-type semantics (components are part of the entities that contain them, and are considered fields of those entities).

5.2.2. Basic value types

The basic types can be roughly divided as follows

integer, long, short, float, double, character, byte, boolean, yes_no, true_false

Mappings of primitive Java types or wrapper classes to the corresponding (vendor-dependent) SQL types of table columns. boolean, yes_no, and true_false are alternative notations for the Java types boolean or java.lang.Boolean.

string

Mapping java.lang.String type to VARCHAR (or Oracle VARCHAR2).

date, time, timestamp

Mapping the java.util.Date type and its subclasses to the SQL types DATE, TIME, and TIMESTAMP (or equivalent).

calendar, calendar_date

Mapping the java.util.Calendar type to the SQL types TIMESTAMP and DATE (or equivalent).

big_decimal

Mapping type java.math.BigDecimal to NUMERIC (or Oracle NUMBER).

locale, timezone, currency

Mapping java.util.Locale, java.util.TimeZone, and java.util.Currency types to VARCHAR (or Oracle VARCHAR2). Locale and Currency instances are mapped to their ISO codes. TimeZone instances are mapped to their identifiers (IDs).

class

Mapping type java.lang.Class to VARCHAR (or Oracle VARCHAR2). Class is displayed as its full name.

binary

Maps byte arrays to the corresponding binary SQL type.

text

Displays long Java strings in SQL CLOB or TEXT.

serializable

Maps serializable Java types to corresponding binary SQL types. You can also denote the Hibernate serializable type as the name of a serializable Java class or interface that is not a base type and does not implement the PersistentEnum interface.

clob, blob

JDBC type mapping of the java.sql.Clob and java.sql.Blob classes. These types may be inconvenient for some applications because blob and clob objects cannot be used outside of transactions. (In addition, drivers do not fully and uniformly support these types.)

Unique identifiers for entities and collections can be of any basic type except binary, blob, and clob. (Composite identifiers are also allowed, see below.)

Basic value types are described by constants declared in net.sf.hibernate.Hibernate. For example, Hibernate.STRING represents the string type.

5.2.3. Persistent enum types

An enumerated type is a basic Java idiom when a class has a constant (small) number of immutable instances (translator's note in Java 5 this was introduced at the language level, in earlier versions a special pattern was used for this). You can create persistent enum types by implementing the net.sf.hibernate.PersistentEnum interface, and defining the toInt() and fromInt() operations:

Package eg; import net.sf.hibernate.PersistentEnum; public class Color implements PersistentEnum ( private final int code; private Color(int code) ( this.code = code; ) public static final Color TABBY = new Color(0); public static final Color GINGER = new Color(1); public static final Color BLACK = new Color(2); public int toInt() ( return code; ) public static Color fromInt(int code) ( switch (code) ( case 0: return TABBY; case 1: return GINGER; case 2: return BLACK; default: throw new RuntimeException("Unknown color code");

The name of a Hibernate type is simply the name of the enumerated class, in this case eg.Color.

5.2.4. Custom value types

It is relatively easy for developers to create their own value types. For example, you might want to store properties of type java.lang.BigInteger into columns of type VARCHAR. Hibernate doesn't provide a built-in type for this. But defining custom types is not limited to mapping properties (or collection elements) to a single table column. So, for example, you can have a property getName()/setName() of type java.lang.String which is stored in the FIRST_NAME, INITIAL, SURNAME columns.

To implement a custom type, implement one of the net.sf.hibernate.UserType or net.sf.hibernate.CompositeUserType interfaces and declare the property using the fully qualified class name of your type implementation. Review net.sf.hibernate.test.DoubleStringType for available capabilities.

Note: use tags to display properties in multiple columns.

Although Hibernate's wealth of built-in types and component support means that you rarely need to use custom types, it is still good practice to use them as (non-entity) classes for types that are frequently used in your application. For example, the MonetoryAmount class is a good candidate for CompositeUserType, although it can be exposed as a component. The main motivation is abstraction. With custom types, your mapping document will be more resilient to possible changes in the future if you change the currency type representation.

5.2.5. Any type display

There is another type for displaying properties. Display element declares a polymorphic association for classes from multiple tables. This type of display always requires more than one column. The first column contains the type of the associated entity. an. It is not possible to define a foreign key for a given association type, so this mapping is not typically used for polymorphic associations. You should use this mapping only in special cases (for example, recording different types of data, accessing user session data).

The meta-type attribute allows an application to define a custom type that maps database column values ​​to persistent classes whose identifier properties are of the type defined by id-type. If the meta-type returns java.lang.Class entities, then nothing else is required. In other cases, when it is a base type such as string or character, you must map the values ​​to the classes.

..... .....

(1)

name: Property name.

(2)

id-type: Identifier type.

(3)

meta-type (optional - defaults to class): a type that maps java.lang.Class into a single database column, or alternatively a type that is allowed to map a discriminator.

(4)

cascade (optional - defaults to none): The type of cascade operation.

(5)

access (optional - defaults to property): The strategy that Hibernate should use to access the value of a property.

The old object property, which has its own place in Hibernate 1.2, is still supported but has been deprecated.

5.3. SQL identifiers in quotes

You can force Hibernate to quote identifiers in SQL statements. Hibernate will follow the quoting rules according to the specified SQL dialect (usually double quotes, but parentheses for SQL Server and backquotes for MySQL).

...

5.4. Individual display files

You can declare subclass and joined-subclass mappings in separate documents, right inside the hibernate-mapping element. This allows the class hierarchy to be expanded by adding a new mapping file. With this approach, you must specify an extends attribute in the subclass mapping containing the name of the pre-mapped superclass. Using this feature makes the order in which the mapping documents are listed important.

Dear friends!

Today we are pleased to inform you that our developers have implemented the ability to transport data via URL (mapping) beyond the target page.

Using this function, you can transfer all the data from the form fields to the page that the user goes to when sending you a lead. Thanks to this, the lead not only gets into , but can also immediately get into your database if he is “met” by the corresponding script on the redirect page.

Now there is no need to export data from the lead processing system! You can send and process them immediately in your own database!

Also, thanks to this function, it becomes possible to congratulate or thank the user who provided his contact information personally.

How does mapping work?

The essence of mapping is that when sending data from form fields, their contents are added to the link to which the redirect occurs. The URL becomes: //my_site.com/?name=NAME&email=EMAIL_ADDRESS&phone=PHONE_NUMBER&lead_id=225298.

Important! In addition to all field data, the lead ID is always passed in the lead_id parameter.

On the page to which the transition is made, this information is “received” by a special script, which, in turn, distributes the data into the appropriate “cells”.

Draw your attention to! Mapping only works if the “Form Result” is “Go to URL”!

How can I set up “transporting” a lead by URL (mapping) on ​​my landing page?

1. Log in.
2. Select the page with the lead form from which you are going to “broadcast” the data.

3. In the editor, double-click on the form.

4. In the window that appears, fill in the “Mapping” column with the corresponding field names in English. For example, name - name, phone - telephone, etc.

5. Save your changes.

6. In the form properties, set up a redirect to the desired page - this could be a page of your site that has JavaScript built into it, which will process the data from the fields received from the URL.

Check the “Pass form fields” checkbox.

7. Save changes in the main editor menu.

That's all! :-)

Now the data from your form fields will be transferred to the page to which you redirect the user. You don't have to export leads from CRM LPgenerator - they can be “transported” to your CRM directly via URL. The possibilities of mapping for transporting data are truly limitless.

Prompt and high-quality decision-making by enterprise management depends on a well-built management accounting system in the company. Management Accounting here, in accordance with generally accepted practice, the use of this term means the use of accounting and financial management principles to solve problems in the following areas of the enterprise:

  • development and implementation of business strategy;
  • implementation of planning and control;
  • efficient use of resources;
  • increasing operational efficiency;
  • preservation of tangible and intangible assets;
  • corporate and intra-company business process management

In any case, access to accounting information is carried out using various types of reports.

Since collecting and storing data on the economic activities of an enterprise is a rather labor-intensive and costly process, the effective use of this information becomes an important task and a competitive advantage. The volume of information collected is determined by the company's management as a compromise solution between the requirements of the state and regulatory authorities for information disclosure and the maximum volume of information (financial, technological, statistical) arising in the process of business activity of the enterprise.

The most effective way to use the information generated in the process of activity is to create a data warehouse (datewarehouse), on the basis of which, using OLAP technologies, any enterprise manager can generate a report to analyze data in the analytical context he needs and provide himself with information for decision-making.

However, at present, the most common option remains the creation of an information system in which data is accumulated and, as a rule, there is a custom report generator that complements the standard reports provided by the system developer.

Typically, software developers offer users regularly updated forms of external (for regulatory authorities) reporting (accounting and tax) and advertise the ability to create any type of management reports required by the enterprise. However, the generated report is not necessarily well-formed.
The enterprise is left alone with the problem of correctly generating (filling out) reports.

The need for an enterprise to generate reporting according to International Standards can only aggravate the situation.

The key point in reporting in all cases is the need to create a connection between credentials in information systems and the corresponding fields in reporting forms.

The following options for organizing the relationship are possible:

  • In the form of a table describing the relationships or correspondence between report fields and data in the system (followed by writing an algorithm for automatic report generation).
  • By manually selecting the necessary information (with a complete lack of ability to automate the report).
  • A mixed version, which requires the presence of interrelation tables and manual decoding and adjustments when generating reports.

The first option for organizing the relationship of information accounting systems with reporting forms (through tables describing relationships) is called “ mapping".

Mapping (in a broad sense) is the transformation of data from one form to another. For accounting, mapping is the compilation of a table of correspondences of accounting accounts from various charts of accounts, for example, the Russian chart of accounts and the GAAP (IFRS) chart of accounts (or chart of accounts of management accounting).

Example 1. Mixed version of the organization of communication.

Most companies prepare reports, for example under IFRS, through transformation. The method is based on an approach according to which information generated according to Russian standards is analyzed and adjusted to bring it into compliance with IFRS.

Reporting is transformed in at least four stages using mapping tables and manual adjustments.

1st stage. Structural transformation of the balance sheet and income statement. The result is a regrouping and aggregation of individual items in the financial statements in order to prepare a database for subsequent adjusting entries. At the same time, the mapping table contains financial reporting indicators under RAS and their reflection in interim reporting under IFRS.

2nd stage. Carrying out adjusting entries aimed at eliminating qualitative differences between Russian reporting and reporting under IFRS. Done manually by a transformation specialist.

3rd stage. Preparation of reporting according to IFRS based on transformed balance sheets, profit and loss statements and other forms. The mapping table includes interim reporting figures under IFRS and a description of the adjustments made by the transformation specialist.

4th stage. Preparation of the descriptive part of the report.

Table 1. Illustration of the relationship between the Russian chart of accounts and the GAAP chart of accounts (extract)

Investment department (taxable)

Investm. Depart (Deductible)

Evaluation Department

Valuat dept. (deductible)

Research Department (taxable)

Research dept. (deductible)

VAT on sales VAT

VAT - services

Cons services VAT

Total revenue

Gross Sales/revenues

Cost of sales

Investm. Depart (Deductible)

Other taxes accrued (TsP)

Other tax collection

Trade margin (discount, cape)

The trade margin (discount, addition)

Supplier discount for reimbursement of transportation costs

The discount of the suppliers on redress of transportation costs

Sales and disposal of fixed assets

Disposal of fixed assets

Sale of other assets

Disposal of other assets

Primary production

The basic production

Auxiliary production

Supplementary productions

General production expenses

General production expenditures

Marketing Department (taxable)

Market Depart (Deductible)

Marketing Department (non-taxable)

Market Depart (nonDeducible)

Sales – main activity

Sales/revenues – main activity

Cost of sales

Gross profit

Net sales

General, selling and administrative expenses

Selling general and administrative expenses

Mapping tables are also used in the generation of corporate management reporting (usually in holding companies and companies with branches).

The basis for setting up mapping is grouping accounting data in a certain way (according to company standards).

Simply put, when creating a corporate reporting line, we indicate exactly which turnovers (or account balances (sub-accounts)) and in what order the automatic accounting system should use to generate this line.

Mapping is the rules you have laid down, according to which the reports you need will be generated. The technical principles for generating mapping lines are the same for all reporting forms, the only difference is in the content.

In this regard, it should be noted that mapping must be configured by qualified specialists and, importantly, in a unified methodological manner. The mapping procedure requires quite a lot of time.

The basis of management accounting (as well as accounting) are: chart of accounts, budget items and various analytical reference books.

However, the management chart of accounts differs significantly from the standard chart of accounts, which is used for accounting by accounting, since some of the accounts of the management chart of accounts (hereinafter referred to as the MCA) may have more detailed analytics, and the other part may have more comprehensive analytics (it all depends on the specific enterprises). The structure of analytical reference books is also different, since management reports require the presentation of accounting information in a completely different context than for accounting reports.

Of course, in practice, linking indicators ( mapping) management, tax and accounting (financial) accounting causes a lot of problems.
Let's look at some of them.

1. Lack of analytics in the working chart of accounts (hereinafter referred to as WCA) of the company.

This is understandable, since enterprises that were created for one day did not always have a long-term strategy, and the interests of shareholders were not always respected. Today, the very culture of business has changed. Shareholders, including the state, are showing increasing interest in how competently and skillfully managers at all levels manage the enterprise.
The solution to this problem is to expand and supplement the company’s existing cash register system and gradually accumulate information on newly introduced accounts (sub-accounts).

Understanding the main approaches to constructing a Chart of Accounts, as well as the three components (financial, tax, management) of a unified accounting system in a company, predetermines the need to highlight three basic components in a systematic approach to the financial accounting system of a commercial organization, namely:

  1. financial (accounting);
  2. tax;
  3. managerial.

Possible interpretations of the financial, tax and management components of a systematic approach to RPS are presented below.

Financial (accounting) component. The use of the RPS should ensure the possibility of generating all (without exception) the resulting accounting and analytical indicators of external financial statements and explanatory notes in the context of the General Ledger accounts as of the reporting date. The block of accounting accounts of the RPS involved in the formation of external accounting reports is financial accounts. In turn, financial accounts are divided into analytical and synthetic. Financial accounting subaccounts of the RPS are intermediate between analytical and synthetic. Moreover, financial analytical and synthetic accounts, as well as sub-accounts, can represent an integral part of the management component of the RPS. For example, the data reflected in individual subaccounts of financial account 90 “Sales” are important for making management decisions.

When forming a group of financial accounts of the RPS, the following requirements must be met:

  1. between external accounting reporting items and financial account balances, a correspondence must be established that does not require additional logical operations to determine the type of reporting item;
  2. the minimum possible set of financial accounts of the RPS must be purposefully formed based on the composition of indicators of external financial reporting;
  3. each external financial reporting indicator must be obtained from financial accounting data using the RPS without any additional decoding or adjustments.

Tax component. The use of RPS in the accounting system provides the ability to calculate the tax base and the amount of profit for tax purposes in accordance with the requirements of Chapter. 25 Tax Code of the Russian Federation. The implementation of the tax component of a systematic approach to RPS involves:

  1. organization of analytical financial and tax accounting of expenses and income in order to identify their impact on the amount of the tax base for calculating the profit tax of a commercial organization by detailing the financial accounts (01 - 99) RPS;
  2. development of a list of tax accounts (for example, 101–199). Their implementation will make it possible to keep records of deviations in the accounting data of financial and tax accounting objects in order to create tax accounting and tax reporting on the basis of financial accounting and financial reporting;
  3. development of rules that make it possible to adjust the impact of the tax component on the unified integrated accounting reporting in order to eliminate duplication of reporting (resulting) accounting and analytical indicators.

Management component. In the RPS, to obtain the resulting accounting and analytical indicators of management internal reporting and management accounting, a block of management accounts is allocated (for example, 201–299). On these management accounts, double-entry adjustments to financial accounts 01–99 are made based on the requirements of users for internal management reporting. In the future, the data on management accounts 201–299, when using certain rules, supplements (corrects) the data on financial accounts 01–99. The result of such actions are indicators of internal management reporting.

The implementation of the management aspect in a systematic approach to the formation of the RPS involves the development of:

  1. accounting policy provisions (external and internal), clarifying the criteria for recognizing accounting items, their assessment, as well as disclosing the content of management reporting items;
  2. subsystem of management accounts of the unified RPS, necessary for recording and summarizing deviations of management accounting data from financial accounting data;
  3. alternative financial reporting composition of management reporting forms.

In addition, when forming a block of management accounts for the RPS, it is necessary to develop a table “Relationship (mapping) between the subsystems of financial and management accounts with indicators of alternative management reporting.”

Table 2. Mapping of Russian accounting (financial) accounting operations to generate lines of the corporate reporting form “Balance” (extract)

Debit turnover

OS in the organization

OS groups:<все>

Invested in non-current
assets

Do not change

Divisions:<все>

Without changes

Project Code:<все>

Do not unfold

Participates in group control with a plus

Fixed Assets: Other fixed assets

Construction Objects (r): Type of Receipts of fixed assets (Receipts from third parties)

Debit turnover

OS without registration

OS groups:<все>

Do not change

Divisions:<все>

Without changes

Project Code:<все>

Do not unfold

Participates in group control with a plus

Fixed Assets: Other fixed assets

Construction Objects (r): Type of Receipts of fixed assets (Receipts from third parties)

Debit turnover

MC in the organization

Invested in non-current assets

Do not change

Without changes

Do not unfold

Participates in group control with a plus

Fixed Asset(s): Type of Fixed Income (Receipt from third parties)

Debit turnover

MC, front. in temporary possession

Contractors:<все>

Invested in non-current
assets

Do not change

Agreements:<все>

Without changes

Project Code:<все>

Do not unfold

Participates in group control with a plus

Fixed Assets: Other fixed assets

Construction Projects (r): Type of ReceiptOS (Receipt from third parties)

Debit turnover

MC, front. for temporary use

Contractors:<все>

Invested in non-current
assets

Do not change

Agreements:<все>

Without changes

Project Code:<все>

Do not unfold

Participates in group control with a plus

Balance Line

Accounting account

Selection by subconto 1

Corr. accounting account

Selection by subconto 1

Selection formula

Selection by subconto 2

Selection by subconto 2

Invert sign

Selection by subconto 3

Selection by subconto 3

VAT accounting

Selection by subconto 4

Selection by subconto 4

Expand by

Selection by subconto 5

Selection by subconto 5

Participation in a group account

BL00102 Put into operation (+)

Put into operation (+)

Put into operation (+)

Put into operation (+)

Put into operation (+)

Put into operation (+)

Undoubtedly, the decision to create an integrated accounting (financial, tax and management) system in a commercial organization and to develop a unified working chart of accounts for such a system based on a standard Chart of Accounts is not unambiguous. Theoretically, the following approaches can be applied to constructing a working chart of accounts for a commercial organization (in the case of using charts of accounts for three types of accounting):

  • a single integrated chart of accounts for financial, tax and management accounting;
  • integrated chart of accounts for financial and tax accounting, autonomous chart of accounts for management accounting;
  • integrated chart of accounts for financial and management accounting; autonomous chart of accounts for tax accounting;
  • integrated chart of accounts for tax and management accounting; autonomous chart of accounts for financial accounting;
  • autonomous charts of accounts for financial, tax, and management accounting.

2. Problems of constructing reference books and classifiers, the main of which are:

  • duplication of information in directories;
  • Incorrect encoding of term directories.

It often happens, for example, that there is no uniform procedure for assigning codes and names; the same counterparty may be listed in the directory twice (Romashka LLC and Romashka LLC, other options and combinations) or under different names (for example, under full and under abbreviated). Searching for the necessary data in an information system using unstructured directories is quite complicated and inconvenient. In addition, clutter in reference books causes errors in reporting.

For example, each enterprise that is part of the holding, to a certain extent, independently maintains primary records, develops and updates its own directories. This work at enterprises is usually carried out by different services: financial departments, marketing department, legal department, etc. All this allows you to make optimal management decisions within a particular enterprise. However, understanding and the ability to analyze the current state of the holding as a whole is very difficult due to the unstructured and unified nature of the information.

Another common situation: in one of the companies, due to regular requests from the marketing department to the accounting department about the sales structure, accountants had to manually collect information in the necessary information sections. This was due to the fact that the sales department did not always enter into the directory the data necessary for the automatic generation of the required reports.

– Incompatibility of parts of the automated accounting system.
For example, the supply department maintains registers and directories of the ITC in the Cache program, and accounting (financial) and management registers and directories are maintained in SAP R3, and company reporting is also generated there. The data presentation formats in these programs are different, so converting data between them is difficult, and in some cases directly impossible.

When developing reference books, the following principles should be adhered to.

– The detail and structure of directories should be such that it is possible to quickly process data and generate the required reports.

If the reference book is not detailed enough, this will make it difficult to obtain the necessary information. For example, if in the middle of the year you need to find out about the costs of producing advertising brochures ordered by the marketing department, and before that all marketing costs were taken into account together, then you will need to make an additional selection of information based on indirect evidence (for example, by printing houses). (For holdings or groups of companies, the detail of the directories will depend on the requirements for structuring information not only of an individual enterprise, but also of the entire holding.)

If the reference book is very detailed, then it is difficult to fill it with information and use it in your work. For example, the “Cash Flow” directory can contain more than a thousand different payment purposes. Preparing a cash flow report for basic payments for the general director will take a lot of time, since you will have to carry out the necessary grouping (aggregation of indicators or selection of the necessary information from an array of redundant information). In addition, when entering information, the user may not know where to include a particular payment. This will inevitably lead to incorrect selection of items from the directory or classification of the payment as “other”. It can be recommended to describe in detail which accounting objects can be reflected for each line of the directory.

– Coding of directory elements should eliminate duplication of information and help speed up work with the directory. Before encoding data, it is necessary to determine in which of the enterprise information systems the reference directories will be stored. The possibility of using certain codes will largely depend on the capabilities of the system. Such a system can be an accounting program, information from which is automatically transferred to other systems that use the same directories.

– You should avoid using similar encodings in different directories.
For example, if, when analyzing sales, the marketing department identifies buyer groups not by region, but by city and region, then the groups for analysis should not coincide with the codes of federal regions. Otherwise, this will lead to errors when entering information. Thus, the code “77” is set for Moscow, and the Belgorod region is listed under this code at the enterprise. As a result, an employee may attribute a certain type of sales not to the region, but to Moscow, and the information will be distorted. In this case, it is recommended to create codes of different lengths, for example, to encode marketing groups, use three digits (code “770” for clients in the Belgorod region);

Ideally The directory code must not exceed 8 characters. Otherwise, data is difficult to enter as the codes are not easily distinguished from each other.

– when creating interconnected directories, duplication should be eliminated. To avoid errors in directories (due to the unsystematic and chaotic nature of filling them out), it is necessary to analyze the information contained in them to identify data that can be generated by individual directories.

– Having developed a unified directory system, it is necessary to ensure its protection from unauthorized changes. Sufficiently high security can usually be achieved both through the use of user identification methods and through the delimitation of user access rights to information. Most often, to create and maintain directories, companies develop regulations that determine those responsible for entering information into directories and its modification.

In conclusion, it should be said that it is necessary to solve the above problems before setting up mapping. Otherwise, it is unlikely that management reporting can be generated. Even if reporting is generated, the likelihood that it will be correct is practically zero. The reasons are obvious:

  1. Errors that will appear due to previously described problems.
  2. Accounting errors (both methodological and accounting). People keep records, don’t forget that.
  3. Next, one should give a long list of various types of errors, the source of which will be the results of the superposition of paragraphs 1 and 2. However, in our opinion, this is unnecessary.

Part 3: Displaying Data from a Table (LIST Operation)

In the previous part, we looked at the types of relationships (one-to-one, one-to-many, many-to-many), as well as one class Book and its mapping class BookMap. In the second part, we will update the Book class, create the remaining classes and connections between them, as was depicted in the previous chapter in the Database Diagram located above the subheading 1.3.1 Relationships.

Code of classes and mappings (With comments)

Class Book

Public class Book ( //Unique identifier public virtual int Id ( get; set; ) // Title public virtual string Name ( get; set; ) // Description public virtual string Description ( get; set; ) // Rating of the World of Fiction public virtual int MfRaiting ( get; set; ) //Page numbers public virtual int PageNumber ( get; set; ) //Link to the picture public virtual string Image (get; set; ) //Date of book arrival (filter by new items!) public virtual DateTime IncomeDate ( get; set; ) //Genre (Many-to-Many) //Why ISet and not IList? Only one collection (IList) can be selected using JOIN fetch, if more than one collection is needed for JOIN fetching, then it is better to convert them into an ISet public virtual ISet collection Genres ( get; set; ) //Series (Many-to-one) public virtual Series Series ( get; set; ) //Opinion and other (One-to-one) private Mind _mind; public virtual Mind Mind ( get ( return _mind ?? (_mind = new Mind()); ) set ( _mind = value; ) ) //Author (Many-to-many) public virtual ISet Authors ( get; set; ) //Initialize in advance so that a null exception does not occur. public Book() ( //Unordered set (one table cannot have two exactly identical rows, otherwise it selects one and ignores the other) Genres = new HashSet ( public BookMap() ( Id(x => x.Id); Map(x => x.Name); Map(x => x.Description); Map(x => x.MfRaiting); Map(x = > x.PageNumber); Map(x => x.Image); Map(x => x.IncomeDate); //Many-to-many relationship HasManyToMany(x => x.Genres) //Cascading rules All - When the object is saved, updated or deleted, all dependent objects are checked and //created/updated/added.Cascade.SaveUpdate() //The name of the intermediate table MUST be the same as the class Genre .Table("Book_Genre"); > x.Authors) .Cascade.SaveUpdate() .Table("Book_Author"); //Many-to-one relationship References(x => x.Series); //One-to-one relationship HasOne(x. => x.Mind).Cascade.All().Constrained();

Public class Author ( public virtual int Id ( get; set; ) //Name-Surname public virtual string Name ( get; set; ) //Biography public virtual string Biography ( get; set; ) //Books public virtual ISet Books ( get; set; ) //Initializing Authors public Author() ( Books=new HashSet (); ) ) // Author Mapping public class AuthorMap: ClassMap

( public AuthorMap() ( Id(x => x.Id); Map(x => x.Name); Map(x => x.Biography); //Many-to-many relationship HasManyToMany(x => x .Books) //Cascade rules All - When an object is saved, updated or deleted, all dependent objects are checked and created/updated/added.Cascade.All() //The owner of the collection is the other end of the relationship (Book) and it will be saved first. . .Inverse() //The name of the intermediate table MUST be the same as the Book class!

Class Genre Public class Genre ( public virtual int Id ( get; set; ) //Name of the genre public virtual string Name (get; set; ) //English name of the genre public virtual string EngName (get; set; ) //Books public virtual ISet Books ( get; set; ) //Initialize books public Genre() ( Books=new HashSet ();

) ) //Genre mapping public class GenreMap: ClassMap

Public class Mind ( public virtual int Id ( get; set; ) //My opinion public virtual string MyMind ( get; set; ) //Fantlab's opinion public virtual string MindFantLab ( get; set; ) //Book public virtual Book Book ( get; set; ) ) //Mapping public class MindMap:ClassMap ( public MindMap() ( Id(x => x.Id); Map(x => x.MyMind); Map(x => x.MindFantLab); //One-to-one relationship HasOne(x => x.Book ); ) )

Class Cycle(Series):

Public class Series ( public virtual int Id ( get; set; ) public virtual string Name ( get; set; ) //I created an IList, not an ISet, because other than Book, Series is not associated with anything else, although you can do and ISet public virtual IList Books ( get; set; ) //Initializing books. public Series() ( Books = new List ();

) ) public class SeriesMap: ClassMap
( public SeriesMap() ( Id(x => x.Id); Map(x => x.Name); //One-to-many relationship HasMany(x => x.Books) ////Owner of the collection . the other end of the relation (Book) and it will be saved first. A little explanation
public virtual ISet Genres(get;set;)

public virtual ISet Authors ( get; set; ) Why ISet
, and not, for example, the IList familiar to many
? If we use IList instead of ISet and try to run the project, we won’t notice much of a difference (Tables and classes will be created). But when we add the Genre and Authors tables to the Book LeftJoin class at the same time, and we also try to display non-repeating records from the Book table (Distinct Book.Id) into a view (View), Nhibernate will throw an exception and an error.

Cannot simultaneously fetch multiple bags.

In such cases, we use ISet, especially since sets are intended for this (they ignore duplicate records).
Many-to-many relationship.
NHibernate has the concept of a “main” table. Although the many-to-many relationship between the Book and Author tables is equivalent (An author can have many books, a book can have many authors), Nhibernate requires the programmer to specify the table that is stored second (has a method. inverse()), that is, first a record will be created/updated/deleted in the Book table, and only then in the Author table.

Many-to-one, one-to-many relationship.

The.Constrained() method tells NHibernate that a record from the Book table must match a record from the Mind table (the id of the Mind table must be equal to the id of the Book table)

If you now run the project and look at the Bibilioteca database, new tables with already formed connections will appear.

Next, fill the created tables with data...
To do this, we will create a test application that will save data in the database, update and delete it, changing the HomeController as follows (we comment on unnecessary sections of the code):
public ActionResult Index() ( using (ISession session = NHibernateHelper.OpenSession()) ( using (ITransaction transaction = session.BeginTransaction()) ( //Create, add var createBook = new Book(); createBook.Name = "Metro2033" ; createBook.Description = "Post-apocalyptic mysticism"; createBook.Authors.Add(new Author ( Name = "Glukhovsky" )); createBook.Genres.Add(new Genre ( Name = "Post-apocalyptic mysticism" )); Series ( Name = "Metro" ); createBook.Mind = new Mind ( MyMind = "Post-apocalyptic mysticism" ); session.SaveOrUpdate(createBook); //Update (By ID) //var series = session.Get (1); //var updateBook = session.Get (1); //updateBook.Name = "Metro2034"; //updateBook.Description = "Dystopia"; //updateBook.Authors.ElementAt(0).Name = "Glukhovsky";

) ) public class SeriesMap: ClassMap

  1. //updateBook.Genres.ElementAt(0).Name = "Dystopia"; () //updateBook.Series = series;;
  2. //updateBook.Mind.MyMind = "11111";//session.SaveOrUpdate(updateBook);
    //Delete (By ID) //var deleteBook = session.Get
    (1); //session.Delete(deleteBook);
    transaction.Commit();
  3. .TransformUsing(Transformers.DistinctRootEntity)- Similar to executing a SQL script: SELECT distinct Book.Id..., (removes duplicate records with the same id)

Types of associations
//updateBook.Mind.MyMind = "11111";

  1. LeftOuterJoin - selects all records from the left table ( Book), and then appends the right table records to them ( Genre). If a corresponding entry is not found in the right table, displays it as Null
  2. RightOuterJoin is the opposite of LEFT JOIN - it selects all records from the right table ( Genre), and then appends the left table records to them ( Book)
  3. InnerJoin - selects only those records from the left tables ( Book) which has a corresponding entry from the right table ( Genre), and then joins them with records from the right table

Let's change the representation as follows:

Index view

@model IEnumerable @( Layout = null; ) Index

@Html.ActionLink("Create New", "Create")

@foreach (var item in Model) ( @(string strSeries = item.Series != null ? item.Series.Name: null;) }
@Html.DisplayNameFor(model => model.Name) @Html.DisplayNameFor(model => model.Mind) @Html.DisplayNameFor(model => model.Series) @Html.DisplayNameFor(model => model.Authors) @Html.DisplayNameFor(model => model.Genres) Operations
@Html.DisplayFor(modelItem => item.Name) @Html.DisplayFor(modelItem => item.Mind.MyMind)@Html.DisplayFor(modelItem => strSeries) @foreach (var author in item.Authors) ( string strAuthor = author != null ? author.Name: null; @Html.DisplayFor(modelItem => strAuthor)
}
@foreach (var genre in item.Genres) ( string strGenre = genre!= null ? genre.Name: null; @Html.DisplayFor(modelItem => strGenre)
}
@Html.ActionLink("Edit", "Edit", new ( id = item.Id )) |


@Html.ActionLink("Details", "Details", new ( id = item.Id )) |
  • @Html.ActionLink("Delete", "Delete", new ( id = item.Id ))
  • Having checked all the operations one by one, we will notice that:

During the Create and Update operations, all data associated with the Book table is updated (remove Cascade="save-update" or cascade="all" and the associated data will not be saved)
When deleting, data is deleted from the Book, Mind, Book_Author tables, but the remaining data is not deleted because they have Cascade="save-update"
//Class of Two-Dimensional Shapes public class TwoDShape ( //Width public virtual int Width ( get; set; ) // Height public virtual int Height ( get; set; ) ) // Class Triangle public class Triangle: TwoDShape ( //Identification number public virtual int Id ( get; set; ) //Type of triangle public virtual string Style ( get; set; ) )

In principle, there is nothing complicated in this mapping; we will simply create one mapping for the derived class, that is, the Triangle table.
//Triangle mapping public class TriangleMap: ClassMap ( public TriangleMap() ( Id(x => x.Id); Map(x => x.Style); Map(x => x.Height); Map(x => x.Width); ) )
After launching the application, the following (empty) table will appear in the Biblioteca database

Tags: Add tags