CN107391529A - A kind of method and device for realizing Object Relation Mapping ORM - Google Patents

A kind of method and device for realizing Object Relation Mapping ORM Download PDF

Info

Publication number
CN107391529A
CN107391529A CN201710193517.0A CN201710193517A CN107391529A CN 107391529 A CN107391529 A CN 107391529A CN 201710193517 A CN201710193517 A CN 201710193517A CN 107391529 A CN107391529 A CN 107391529A
Authority
CN
China
Prior art keywords
data
tables
object model
model
field
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201710193517.0A
Other languages
Chinese (zh)
Other versions
CN107391529B (en
Inventor
何嘉文
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Advanced New Technologies Co Ltd
Advantageous New Technologies Co Ltd
Original Assignee
Alibaba Group Holding Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Priority to CN201710193517.0A priority Critical patent/CN107391529B/en
Publication of CN107391529A publication Critical patent/CN107391529A/en
Application granted granted Critical
Publication of CN107391529B publication Critical patent/CN107391529B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/28Databases characterised by their database models, e.g. relational or object models
    • G06F16/284Relational databases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/28Databases characterised by their database models, e.g. relational or object models
    • G06F16/289Object oriented databases

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The embodiment of the present application discloses a kind of method and device for realizing Object Relation Mapping ORM.Methods described includes:Tables of data semanteme configuration information is obtained, each field of tables of data is included in the tables of data semanteme configuration information;According to the tables of data semanteme configuration information, object model is generated, containment mapping function in the object model, and the object properties corresponding to each field, include following logic in the mapping function:The object properties are directly accessed, to give the field assignment with the field to the object properties assignment or with the object properties;According to the object model, object corresponding to the object model is mapped with the data in the tables of data.Using the embodiment of the present application, reflex mechanism is based on without the runtime in program, you can realize ORM, therefore, advantageously reduce performance cost, mitigate the pressure to equipment.

Description

A kind of method and device for realizing Object Relation Mapping ORM
Technical field
The application is related to computer software technical field, more particularly to one kind realizes Object Relation Mapping (Object Relational Mapping, ORM) method and device.
Background technology
ORM is a kind of to solve existing for object-oriented and relational database the mutually technology of unmatched phenomenon.
ORM can be realized is persisted to the object in program in relational database automatically, and can be by relation data Digital independent in storehouse is object.In this way, developer can more be absorbed in the work of each user interface layer of Business Logic, and Most of work of data access layer can be then automatically performed by ORM, be advantageous to improve development efficiency.
In the prior art, typically in the runtime of program, based on reflex mechanism, generation object model and access object Object properties corresponding to model, to realize ORM.
But it is larger due to reflecting performance cost itself, it is therefore, larger to the pressure of equipment.Particularly with mobile terminal Equipment, the program operation in equipment is likely to result in slowly or the problems such as interim card.
The content of the invention
The embodiment of the present application provides a kind of method and device for realizing ORM, to solve following technology of the prior art Problem:In the runtime of program, ORM is realized based on reflex mechanism, and it is larger due to reflecting performance cost itself, it is therefore, right The pressure of equipment is larger.
In order to solve the above technical problems, what the embodiment of the present application was realized in:
A kind of method for realizing ORM that the embodiment of the present application provides, including:
Tables of data semanteme configuration information is obtained, each field of tables of data is included in the tables of data semanteme configuration information;
According to the tables of data semanteme configuration information, object model is generated, containment mapping function in the object model, with And the object properties corresponding to each field, following logic is included in the mapping function:The object properties are directly accessed, To give the field assignment with the field to the object properties assignment or with the object properties;
According to the object model, object corresponding to the object model is reflected with the data in the tables of data Penetrate.
A kind of device for realizing ORM that the embodiment of the present application provides, including:
Configuration module, tables of data semanteme configuration information is obtained, tables of data is included in the tables of data semanteme configuration information Each field;
Model module, according to the tables of data semanteme configuration information, object model is generated, includes and reflects in the object model Function, and the object properties corresponding to each field are penetrated, following logic is included in the mapping function:Described in directly accessing Object properties, to give the field assignment with the field to the object properties assignment or with the object properties;
Mapping block, according to the object model, to the number in object corresponding to the object model and the tables of data According to being mapped.
Above-mentioned at least one technical scheme that the embodiment of the present application uses can reach following beneficial effect:Without in program Runtime be based on reflex mechanism, you can realize ORM, therefore, advantageously reduce performance cost, mitigate the pressure to equipment, can Partly or entirely to solve the problems of the prior art.
Brief description of the drawings
, below will be to embodiment or existing in order to illustrate more clearly of the embodiment of the present application or technical scheme of the prior art There is the required accompanying drawing used in technology description to be briefly described, it should be apparent that, drawings in the following description are only this Some embodiments described in application, for those of ordinary skill in the art, do not paying the premise of creative labor Under, other accompanying drawings can also be obtained according to these accompanying drawings.
Fig. 1 is a kind of schematic flow sheet for method for realizing ORM that the embodiment of the present application provides;
Fig. 2 is under a kind of practical application scene that the embodiment of the present application provides, and one kind of the above-mentioned method for realizing ORM is specific The schematic flow sheet of embodiment;
Fig. 3 is a kind of structural representation for device for realizing ORM corresponding to Fig. 1 that the embodiment of the present application provides.
Embodiment
The embodiment of the present application provides a kind of method and device for realizing ORM.
In order that those skilled in the art more fully understand the technical scheme in the application, it is real below in conjunction with the application The accompanying drawing in example is applied, the technical scheme in the embodiment of the present application is clearly and completely described, it is clear that described implementation Example only some embodiments of the present application, rather than whole embodiments.It is common based on the embodiment in the application, this area The every other embodiment that technical staff is obtained under the premise of creative work is not made, it should all belong to the application protection Scope.
Fig. 1 is a kind of schematic flow sheet for method for realizing ORM that the embodiment of the present application provides.For program angle, The executive agent of the flow can be client or service end;For slave unit angle, the executive agent of the flow can include But it is not limited to following equipment:Mobile phone, tablet personal computer, intelligent watch, vehicle device, personal computer, big-and-middle-sized computer, computer collection Group etc..
Flow in Fig. 1 may comprise steps of:
S101:Tables of data semanteme configuration information is obtained, each word of tables of data is included in the tables of data semanteme configuration information Section.
In the embodiment of the present application, tables of data semanteme configuration information can be set beforehand through machine mode or manual type Meter.Each tables of data can correspond to a set of tables of data semanteme configuration information respectively.
The relevant information of each field of tables of data can be included in tables of data semanteme configuration information, such as, field name, word Data type name, the acquiescence value etc. of field corresponding to section.The data can also be included in tables of data semanteme configuration information Whether the title of table, the title and database of correspondence database the information such as encrypt.
Usually, each field can be specifically any bar data record of the row field of tables of data, the then tables of data It can be made up of each field and its value.
In the embodiment of the present application, used for the ease of follow-up, tables of data semanteme configuration information can be with certain number According to form, such as, can be with extensible markup language (XML) form, JSON forms etc..
S102:According to the tables of data semanteme configuration information, object model is generated, containment mapping letter in the object model Number, and object properties corresponding to each field, following logic is included in the mapping function:Directly access the object Attribute, to give the field assignment with the field to the object properties assignment or with the object properties.
In the embodiment of the present application, object model belongs to service logic model, and specified parameter is inputted into the object model Corresponding object can be obtained, the object is the example for the class that Object-Oriented Programming Language is write.
Correspondingly, the object properties corresponding to each field can be included in the object.Based on these object properties, The object and the mapping of the data in tables of data described in each field can be realized, you can to realize ORM.
In the embodiment of the present application, object model can be the compiling product of source code form or source code Form.
In the embodiment of the present application, based on the logic included in mapping function, without being given birth in the runtime using reflex mechanism Into object model to realize ORM, but object properties are with reality corresponding to the object model that can be generated in advance by directly accessing Existing ORM.
S103:According to the object model, object corresponding to the object model is entered with the data in the tables of data Row mapping.
In the embodiment of the present application, can be data by object map corresponding to object model according to the object model Data in table, the data in tables of data can also be mapped as to object corresponding to object model, and prior art can be avoided Middle at least part reflective operation.
By Fig. 1 method, reflex mechanism is based on without the runtime in program, you can realize ORM, therefore, be advantageous to Performance cost is reduced, mitigates the pressure to equipment, can partly or entirely solve the problems of the prior art.
Method based on Fig. 1, the embodiment of the present application additionally provide some specific embodiments of this method, and extension side Case, it is illustrated below.
Platform reuse also be present in addition to depositing the problem of stated in the background in prior art.Specifically, it is existing Have and realize that ORM scheme is difficult to be multiplexed in different platform in technology.The platform can refer to operating system platform, such as, Android platform, iOS platforms etc.;The application platform being equipped on operating system can also be referred to, such as, HTML5 platforms etc.. The scheme of the application can also partly or entirely solve the problems, such as the platform reuse.
Specifically, it is described according to the tables of data semanteme configuration information for step S102, object model is generated, specifically It can include:Obtain the Object model template of the Platform Designing for specifying;According to the tables of data semanteme configuration information and institute Object model template is stated, generates object model, the platform includes operating system platform.
As can be seen here, different platforms can be directed in advance, separately design corresponding Object model template.For same set of Tables of data semanteme configuration information, it can be used with reference to different Object model templates, so as to by the scheme of the application Advantageously it is multiplexed in different platform.
In actual applications, in order to reduce cost, existing template engine design plant model template can be based on, than Such as, the template engine such as Mustache, Hogan.In order to make it easy to understand, by taking the template engines such as Mustache as an example, object mould is generated The step of code of type, can include following:
Read tables of data semanteme configuration information;The tables of data semanteme configuration information of reading is used as by Mustache defeated Enter;The code character string of reading object model template;Corresponding contents in tables of data semanteme configuration information are tied to object mould In the code character string of pattern plate;Character string after binding is written in code file, that is, completes the code life of object model Into.
In actual applications, the generating process of the code of object model can also be:According to tables of data semanteme configuration information, The process being compiled to Object model template, wherein, compiling product is the code of object model.Can be by predetermined compiling Script realizes the process of compiling.
In the embodiment of the present application, the code of object model can be generated in compiling duration, in the code of object model After generation, object model can be regenerated in the runtime.Specifically, it is described semantic according to the tables of data for step S102 Configuration information, object model is generated, can specifically be included:In compiling duration, according to the tables of data semanteme configuration information, generation pair As the code of model;In the runtime, according to the code of the object model, the object model is generated.
In the embodiment of the present application, when the side of being mapped is the data in the tables of data, for step S103, described According to the object model, object corresponding to the object model is mapped with the data in the tables of data, specifically can be with Including:
According to the object model, object corresponding to the object model is generated;
Performed for the data record in the tables of data:
Read each field of the data record;
According to the mapping function included in the object model, by directly accessing the object category in the object Property, it is corresponding each object properties assignment in the object with each field of reading;The object after assignment is obtained, as by described Data record maps to obtain object corresponding to the object model.
In this case, mapping function such as can be following form:
Wherein, " this " represents the object, " this.field_field3 ", " this.field_field1 ", " this.field_field2 " represents the object properties of the object;" cu " is denoted as a variable of vernier, is carried with the vernier The field of the data record in database is taken, " cu.getLong (0) " represents that what is extracted corresponds to " this.field_ Field3 " field, " cu.getString (1) " represent the field corresponding to " this.field_field1 " extracted, " cu.getString (0) " represents the field corresponding to " this.field_field2 " extracted.It can be seen that reflected at this Penetrate in function, be the object properties by directly accessing the object, using with corresponding field as the object properties assignment.
Similarly, when being object corresponding to the object model by conversion side, for step S103, described in the basis Object model, object corresponding to the object model is changed with the data in the tables of data, specifically included:
Generate the data record of the tables of data;
Performed for object corresponding to the object model:
According to the mapping function included in the object model, by directly accessing the object category in the object Property, read the object corresponding to the tables of data each field object properties, and with reading each object properties be institute State corresponding each field assignment in data record;
The data record after assignment is obtained, as the data in the tables of data obtained by the object map.
In this case, mapping function such as can be following form:
Wherein, bindArg represents the array for preserving the data record in database, each element point of the array A field of the data record, bindArgs [0], bindArgs [1], the element that bindArgs [2] is array are not represented; " this " represents the object, " this.field_field3 ", " this.field_field1 ", " this.field_field2 " The object properties of the object extracted are represented, " this.field_field3 " represents that what is extracted corresponds to " bindArgs [0] " object properties, " this.field_field1 " represent the object properties corresponding to " bindArgs [1] " extracted, " this.field_field2 " represents the object properties corresponding to " bindArgs [2] " extracted.It can be seen that reflected at this Penetrate in function, be the object properties by directly accessing the object, using with the object properties as corresponding to field assignment.
A kind of method for realizing ORM provided above the embodiment of the present application is illustrated.In order to make it easy to understand, this Shen Please embodiment additionally provide under a kind of practical application scene, a kind of flow of specific embodiment of the above-mentioned method for realizing ORM Schematic diagram, as shown in Figure 2.
Under the scene, database is located on the mobile terminal devices such as mobile phone, is respectively Android platform and iOS in advance The corresponding Object model template of the two Mobile operating system Platform Designings, and be the Data Sheet Design in database in advance Corresponding tables of data semanteme configuration information.
Flow in Fig. 2 mainly may comprise steps of:
In compiling duration, tables of data semanteme configuration information is passed to object model code generator;
Object model code generator obtains the Object model template corresponding to the platform according to the platform specified;Specify Platform be Android platform or iOS platforms;
According to tables of data semanteme configuration information and Object model template, generation is applied to specify object model code generator Platform object model code;
Android platform or iOS platforms applies in runtime, object model corresponding to calling on mobile terminal device Code, object model is generated, for realizing ORM, during ORM, can directly access object corresponding to object model Attribute, so as to avoid reflective operation.
The embodiment of the present application additionally provides a kind of tables of data semanteme configuration information under the scene as an example, the tables of data Semantic configuration information is XML format, as follows:
In the tables of data semanteme configuration information:Tables of data in " table " tag representation database, marked at " table " Sign, the title of " name " tag representation tables of data, the field in " field " tag representation tables of data;In " field " label Under, the title of " name " tag representation field, the data type of " type " tag representation field, " default " tag representation word The acquiescence value of section;The index of " Index " tag representation field.
Can be respectively Android platform and the corresponding object generated of iOS platforms according to the tables of data semanteme configuration information The code of model, the label value in the tables of data semanteme configuration information can be included in code, can be with as object properties Include above-mentioned mapping function etc..The code of object model corresponding to different platform is all similar, master in terms of service logic Distinguish or be used programming language, the programming language that Android platform uses for java, iOS platforms use Programming language is Objective-C.
Based on same invention thinking, the embodiment of the present application additionally provide it is above-mentioned realize device corresponding to ORM method, such as Shown in Fig. 3.
A kind of structural representation for device for realizing ORM corresponding to Fig. 1 that Fig. 3 provides for the embodiment of the present application, the dress Putting to be located in Fig. 1 on the executive agent of flow, including:
Configuration module 301, tables of data semanteme configuration information is obtained, tables of data is included in the tables of data semanteme configuration information Each field;
Model module 302, according to the tables of data semanteme configuration information, object model is generated, is wrapped in the object model Containing mapping function, and the object properties corresponding to each field, following logic is included in the mapping function:Directly access The object properties, to give the field assignment with the field to the object properties assignment or with the object properties;
Mapping block 303, according to the object model, in object corresponding to the object model and the tables of data Data are mapped.
Alternatively, the model module 302 generates object model, specific bag according to the tables of data semanteme configuration information Include:
The model module 302 obtains the Object model template of the Platform Designing for specifying;
According to the tables of data semanteme configuration information and the Object model template, object model, the platform bag are generated Include operating system platform.
Alternatively, the model module 302 generates object model, specific bag according to the tables of data semanteme configuration information Include:
The model module 302 is in compiling duration, according to the tables of data semanteme configuration information, generates the generation of object model Code;
In the runtime, according to the code of the object model, the object model is generated.
Alternatively, when the side of being mapped is the data in the tables of data, the mapping block 303 is according to the object mould Type, object corresponding to the object model is mapped with the data in the tables of data, specifically included:
The mapping block 303 generates object corresponding to the object model according to the object model;
Performed for the data record in the tables of data:
Read each field of the data record;
According to the mapping function included in the object model, by directly accessing the object category in the object Property, it is corresponding each object properties assignment in the object with each field of reading;
The object after assignment is obtained, as the object as corresponding to the data record maps to obtain the object model.
Alternatively, when being object corresponding to the object model by conversion side, the mapping block 303 is according to described right As model, object corresponding to the object model is changed with the data in the tables of data, specifically included:
The mapping block 303 generates the data record of the tables of data;
Performed for object corresponding to the object model:
According to the mapping function included in the object model, by directly accessing the object category in the object Property, read the object corresponding to the tables of data each field object properties, and with reading each object properties be institute State corresponding each field assignment in data record;
The data record after assignment is obtained, as the data in the tables of data obtained by the object map.
The apparatus and method that the embodiment of the present application provides are one-to-one, and therefore, device also has corresponding side The similar advantageous effects of method, due to the advantageous effects of method being described in detail above, therefore, here Repeat no more the advantageous effects of corresponding intrument.
In the 1990s, the improvement for a technology can clearly distinguish be on hardware improvement (for example, Improvement to circuit structures such as diode, transistor, switches) or software on improvement (improvement for method flow).So And as the development of technology, the improvement of current many method flows can be considered as directly improving for hardware circuit. Designer nearly all obtains corresponding hardware circuit by the way that improved method flow is programmed into hardware circuit.Cause This, it cannot be said that the improvement of a method flow cannot be realized with hardware entities module.For example, PLD (Programmable Logic Device, PLD) (such as field programmable gate array (Field Programmable Gate Array, FPGA)) it is exactly such a integrated circuit, its logic function is determined by user to device programming.By designer Voluntarily programming comes a digital display circuit " integrated " on a piece of PLD, without asking chip maker to design and make Special IC chip.Moreover, nowadays, substitution manually makes IC chip, this programming is also used instead mostly " patrols Volume compiler (logic compiler) " software realizes that software compiler used is similar when it writes with program development, And the source code before compiling also write by handy specific programming language, this is referred to as hardware description language (Hardware Description Language, HDL), and HDL is also not only a kind of, but have many kinds, such as ABEL (Advanced Boolean Expression Language)、AHDL(Altera Hardware Description Language)、Confluence、CUPL(Cornell University Programming Language)、HDCal、JHDL (Java Hardware Description Language)、Lava、Lola、MyHDL、PALASM、RHDL(Ruby Hardware Description Language) etc., VHDL (Very-High-Speed are most generally used at present Integrated Circuit Hardware Description Language) and Verilog.Those skilled in the art also should This understands, it is only necessary to method flow slightly programming in logic and is programmed into integrated circuit with above-mentioned several hardware description languages, Can is readily available the hardware circuit for realizing the logical method flow.
Controller can be implemented in any suitable manner, for example, controller can take such as microprocessor or processing Device and storage can by the computer of the computer readable program code (such as software or firmware) of (micro-) computing device Read medium, gate, switch, application specific integrated circuit (Application Specific Integrated Circuit, ASIC), the form of programmable logic controller (PLC) and embedded microcontroller, the example of controller include but is not limited to following microcontroller Device:ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20 and Silicone Labs C8051F320, are deposited Memory controller is also implemented as a part for the control logic of memory.It is also known in the art that except with Pure computer readable program code mode realized beyond controller, completely can be by the way that method and step is carried out into programming in logic to make Controller is obtained in the form of gate, switch, application specific integrated circuit, programmable logic controller (PLC) and embedded microcontroller etc. to come in fact Existing identical function.Therefore this controller is considered a kind of hardware component, and various for realizing to including in it The device of function can also be considered as the structure in hardware component.Or even, can be by for realizing that the device of various functions regards For that not only can be the software module of implementation method but also can be the structure in hardware component.
System, device, module or the unit that above-described embodiment illustrates, it can specifically be realized by computer chip or entity, Or realized by the product with certain function.One kind typically realizes that equipment is computer.Specifically, computer for example may be used Think personal computer, laptop computer, cell phone, camera phone, smart phone, personal digital assistant, media play It is any in device, navigation equipment, electronic mail equipment, game console, tablet PC, wearable device or these equipment The combination of equipment.
For convenience of description, it is divided into various units during description apparatus above with function to describe respectively.Certainly, this is being implemented The function of each unit can be realized in same or multiple softwares and/or hardware during application.
It should be understood by those skilled in the art that, embodiments of the invention can be provided as method, system or computer program Product.Therefore, the present invention can use the reality in terms of complete hardware embodiment, complete software embodiment or combination software and hardware Apply the form of example.Moreover, the present invention can use the computer for wherein including computer usable program code in one or more The computer program production that usable storage medium is implemented on (including but is not limited to magnetic disk storage, CD-ROM, optical memory etc.) The form of product.
The present invention is the flow with reference to method according to embodiments of the present invention, equipment (system) and computer program product Figure and/or block diagram describe.It should be understood that can be by every first-class in computer program instructions implementation process figure and/or block diagram Journey and/or the flow in square frame and flow chart and/or block diagram and/or the combination of square frame.These computer programs can be provided The processors of all-purpose computer, special-purpose computer, Embedded Processor or other programmable data processing devices is instructed to produce A raw machine so that produced by the instruction of computer or the computing device of other programmable data processing devices for real The device for the function of being specified in present one flow of flow chart or one square frame of multiple flows and/or block diagram or multiple square frames.
These computer program instructions, which may be alternatively stored in, can guide computer or other programmable data processing devices with spy Determine in the computer-readable memory that mode works so that the instruction being stored in the computer-readable memory, which produces, to be included referring to Make the manufacture of device, the command device realize in one flow of flow chart or multiple flows and/or one square frame of block diagram or The function of being specified in multiple square frames.
These computer program instructions can be also loaded into computer or other programmable data processing devices so that counted Series of operation steps is performed on calculation machine or other programmable devices to produce computer implemented processing, so as in computer or The instruction performed on other programmable devices is provided for realizing in one flow of flow chart or multiple flows and/or block diagram one The step of function of being specified in individual square frame or multiple square frames.
In a typical configuration, computing device includes one or more processors (CPU), input/output interface, net Network interface and internal memory.
Internal memory may include computer-readable medium in volatile memory, random access memory (RAM) and/or The forms such as Nonvolatile memory, such as read-only storage (ROM) or flash memory (flash RAM).Internal memory is computer-readable medium Example.
Computer-readable medium includes permanent and non-permanent, removable and non-removable media can be by any method Or technology come realize information store.Information can be computer-readable instruction, data structure, the module of program or other data. The example of the storage medium of computer includes, but are not limited to phase transition internal memory (PRAM), static RAM (SRAM), moved State random access memory (DRAM), other kinds of random access memory (RAM), read-only storage (ROM), electric erasable Programmable read only memory (EEPROM), fast flash memory bank or other memory techniques, read-only optical disc read-only storage (CD-ROM), Digital versatile disc (DVD) or other optical storages, magnetic cassette tape, the storage of tape magnetic rigid disk or other magnetic storage apparatus Or any other non-transmission medium, the information that can be accessed by a computing device available for storage.Define, calculate according to herein Machine computer-readable recording medium does not include temporary computer readable media (transitory media), such as data-signal and carrier wave of modulation.
It should also be noted that, term " comprising ", "comprising" or its any other variant are intended to nonexcludability Comprising so that process, method, commodity or equipment including a series of elements not only include those key elements, but also wrapping Include the other element being not expressly set out, or also include for this process, method, commodity or equipment intrinsic want Element.In the absence of more restrictions, the key element limited by sentence "including a ...", it is not excluded that wanted including described Other identical element also be present in the process of element, method, commodity or equipment.
The application can be described in the general context of computer executable instructions, such as program Module.Usually, program module includes performing particular task or realizes routine, program, object, the group of particular abstract data type Part, data structure etc..The application can also be put into practice in a distributed computing environment, in these DCEs, by Task is performed and connected remote processing devices by communication network.In a distributed computing environment, program module can be with In the local and remote computer-readable storage medium including storage device.
Each embodiment in this specification is described by the way of progressive, identical similar portion between each embodiment Divide mutually referring to what each embodiment stressed is the difference with other embodiment.It is real especially for system For applying example, because it is substantially similar to embodiment of the method, so description is fairly simple, related part is referring to embodiment of the method Part explanation.
Embodiments herein is the foregoing is only, is not limited to the application.For those skilled in the art For, the application can have various modifications and variations.All any modifications made within spirit herein and principle, it is equal Replace, improve etc., it should be included within the scope of claims hereof.

Claims (10)

  1. A kind of 1. method for realizing Object Relation Mapping ORM, it is characterised in that including:
    Tables of data semanteme configuration information is obtained, each field of tables of data is included in the tables of data semanteme configuration information;
    According to the tables of data semanteme configuration information, object model is generated, containment mapping function in the object model, and it is right The object properties of each field described in Ying Yu, following logic is included in the mapping function:Directly access the object properties, with The field to the object properties assignment or gives the field assignment with the object properties;
    According to the object model, object corresponding to the object model is mapped with the data in the tables of data.
  2. 2. the method as described in claim 1, it is characterised in that described according to the tables of data semanteme configuration information, generation pair As model, specifically include:
    Obtain the Object model template of the Platform Designing for specifying;
    According to the tables of data semanteme configuration information and the Object model template, object model is generated, the platform includes behaviour Make system platform.
  3. 3. the method as described in claim 1, it is characterised in that described according to the tables of data semanteme configuration information, generation pair As model, specifically include:
    In compiling duration, according to the tables of data semanteme configuration information, the code of object model is generated;
    In the runtime, according to the code of the object model, the object model is generated.
  4. 4. the method as described in claim 1, it is characterised in that described when the side of being mapped is the data in the tables of data According to the object model, object corresponding to the object model is mapped with the data in the tables of data, specific bag Include:
    According to the object model, object corresponding to the object model is generated;
    Performed for the data record in the tables of data:
    Read each field of the data record;
    According to the mapping function included in the object model, by directly accessing the object properties in the object, use Each field read is corresponding each object properties assignment in the object;
    The object after assignment is obtained, as the object as corresponding to the data record maps to obtain the object model.
  5. 5. the method as described in claim 1, it is characterised in that when being object corresponding to the object model by conversion side, It is described object corresponding to the object model to be changed with the data in the tables of data according to the object model, have Body includes:
    Generate the data record of the tables of data;
    Performed for object corresponding to the object model:
    According to the mapping function included in the object model, by directly accessing the object properties in the object, read Go out the object corresponding to the tables of data each field object properties, and with reading each object properties be the data Corresponding each field assignment in record;
    The data record after assignment is obtained, as the data in the tables of data obtained by the object map.
  6. A kind of 6. device for realizing Object Relation Mapping ORM, it is characterised in that including:
    Configuration module, tables of data semanteme configuration information is obtained, each word of tables of data is included in the tables of data semanteme configuration information Section;
    Model module, according to the tables of data semanteme configuration information, generate object model, containment mapping letter in the object model Number, and object properties corresponding to each field, following logic is included in the mapping function:Directly access the object Attribute, to give the field assignment with the field to the object properties assignment or with the object properties;
    Mapping block, according to the object model, object corresponding to the object model is entered with the data in the tables of data Row mapping.
  7. 7. device as claimed in claim 6, it is characterised in that the model module matches somebody with somebody confidence according to the tables of data is semantic Breath, object model is generated, is specifically included:
    The model module obtains the Object model template of the Platform Designing for specifying;
    According to the tables of data semanteme configuration information and the Object model template, object model is generated, the platform includes behaviour Make system platform.
  8. 8. device as claimed in claim 6, it is characterised in that the model module matches somebody with somebody confidence according to the tables of data is semantic Breath, object model is generated, is specifically included:
    The model module is in compiling duration, according to the tables of data semanteme configuration information, generates the code of object model;
    In the runtime, according to the code of the object model, the object model is generated.
  9. 9. device as claimed in claim 6, it is characterised in that described when the side of being mapped is the data in the tables of data Mapping block reflects according to the object model to object corresponding to the object model with the data in the tables of data Penetrate, specifically include:
    The mapping block generates object corresponding to the object model according to the object model;
    Performed for the data record in the tables of data:
    Read each field of the data record;
    According to the mapping function included in the object model, by directly accessing the object properties in the object, use Each field read is corresponding each object properties assignment in the object;
    The object after assignment is obtained, as the object as corresponding to the data record maps to obtain the object model.
  10. 10. device as claimed in claim 6, it is characterised in that when being object corresponding to the object model by conversion side, The mapping block is carried out according to the object model to the data in object corresponding to the object model and the tables of data Conversion, is specifically included:
    The mapping block generates the data record of the tables of data;
    Performed for object corresponding to the object model:
    According to the mapping function included in the object model, by directly accessing the object properties in the object, read Go out the object corresponding to the tables of data each field object properties, and with reading each object properties be the data Corresponding each field assignment in record;
    The data record after assignment is obtained, as the data in the tables of data obtained by the object map.
CN201710193517.0A 2017-03-28 2017-03-28 Method and device for realizing Object Relation Mapping (ORM) Active CN107391529B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710193517.0A CN107391529B (en) 2017-03-28 2017-03-28 Method and device for realizing Object Relation Mapping (ORM)

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710193517.0A CN107391529B (en) 2017-03-28 2017-03-28 Method and device for realizing Object Relation Mapping (ORM)

Publications (2)

Publication Number Publication Date
CN107391529A true CN107391529A (en) 2017-11-24
CN107391529B CN107391529B (en) 2020-12-08

Family

ID=60338346

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710193517.0A Active CN107391529B (en) 2017-03-28 2017-03-28 Method and device for realizing Object Relation Mapping (ORM)

Country Status (1)

Country Link
CN (1) CN107391529B (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108897897A (en) * 2018-07-24 2018-11-27 艾普阳科技(深圳)有限公司 A kind of data processing method and device
CN109522319A (en) * 2018-11-12 2019-03-26 北京懿医云科技有限公司 Data mapping method and device, electronic equipment, storage medium based on DSL
CN109814843A (en) * 2018-12-27 2019-05-28 中链科技有限公司 A kind of object-based page assignment method and system
CN109871657A (en) * 2019-03-21 2019-06-11 北京经纬恒润科技有限公司 A kind of data processing method and device

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102841889A (en) * 2011-06-20 2012-12-26 中兴通讯股份有限公司 Method and device for achieving efficient database access based on ORM (object relational mapping) architecture
CN103853759A (en) * 2012-12-03 2014-06-11 方正国际软件(北京)有限公司 Self-adaptive form generation method and self-adaptive form generation system
CN103995781A (en) * 2014-06-10 2014-08-20 浪潮通用软件有限公司 Method for generating component testing use cases based on model
CN104899225A (en) * 2014-03-07 2015-09-09 北京四达时代软件技术股份有限公司 Object relational mapping method and device as well as processor
CN105550263A (en) * 2015-12-05 2016-05-04 百势软件(北京)有限公司 Assignment method and device in object-relational mapping
US20170068703A1 (en) * 2014-07-25 2017-03-09 Jing-Hao Ju Local database cache

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102841889A (en) * 2011-06-20 2012-12-26 中兴通讯股份有限公司 Method and device for achieving efficient database access based on ORM (object relational mapping) architecture
CN103853759A (en) * 2012-12-03 2014-06-11 方正国际软件(北京)有限公司 Self-adaptive form generation method and self-adaptive form generation system
CN104899225A (en) * 2014-03-07 2015-09-09 北京四达时代软件技术股份有限公司 Object relational mapping method and device as well as processor
CN103995781A (en) * 2014-06-10 2014-08-20 浪潮通用软件有限公司 Method for generating component testing use cases based on model
US20170068703A1 (en) * 2014-07-25 2017-03-09 Jing-Hao Ju Local database cache
CN105550263A (en) * 2015-12-05 2016-05-04 百势软件(北京)有限公司 Assignment method and device in object-relational mapping

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108897897A (en) * 2018-07-24 2018-11-27 艾普阳科技(深圳)有限公司 A kind of data processing method and device
CN108897897B (en) * 2018-07-24 2021-01-05 艾普阳科技(深圳)有限公司 Data processing method and device
CN109522319A (en) * 2018-11-12 2019-03-26 北京懿医云科技有限公司 Data mapping method and device, electronic equipment, storage medium based on DSL
CN109814843A (en) * 2018-12-27 2019-05-28 中链科技有限公司 A kind of object-based page assignment method and system
CN109871657A (en) * 2019-03-21 2019-06-11 北京经纬恒润科技有限公司 A kind of data processing method and device

Also Published As

Publication number Publication date
CN107391529B (en) 2020-12-08

Similar Documents

Publication Publication Date Title
CN107656914B (en) Configurable table generation method and device, terminal equipment and storage medium
CN107506181A (en) Business processing, data processing method, device and electronic equipment
CN107025559A (en) A kind of method for processing business and device
CN107562775A (en) A kind of data processing method and equipment based on block chain
CN107450972A (en) A kind of dispatching method, device and electronic equipment
CN109597661A (en) A kind of service function configuration method and device
CN107391529A (en) A kind of method and device for realizing Object Relation Mapping ORM
CN107562467A (en) Page rendering method, apparatus and equipment
CN110648138B (en) Transaction query and transaction data processing method, device and equipment based on block chain
CN107644286A (en) Workflow processing method and device
CN102609255B (en) A kind of generation method of Spring IOC configuration file
CN108170667A (en) Term vector processing method, device and equipment
CN107679700A (en) Business flow processing method, apparatus and server
CN107368292A (en) A kind of resource Compilation Method and device
CN107590205A (en) A kind of service showing method, device and equipment
CN107622080A (en) A kind of data processing method and equipment
CN108170435A (en) A kind of source code conversion method, device and equipment
CN107045438A (en) One kind application top level view processing method, device and component
CN107786630A (en) A kind of web applications packet processing method, device and equipment
CN104915186B (en) A kind of method and apparatus making the page
CN103927385A (en) Unifying method and device of data model
CN107562777A (en) Data processing method and its equipment
CN106293669A (en) A kind of generation method and apparatus of web pages component
CN108255471B (en) System configuration item configuration device, method and equipment based on configuration suite
CN107391537A (en) Generation method, device and the equipment of data relationship model

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
TA01 Transfer of patent application right

Effective date of registration: 20201016

Address after: Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman Islands

Applicant after: Innovative advanced technology Co.,Ltd.

Address before: Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman Islands

Applicant before: Advanced innovation technology Co.,Ltd.

Effective date of registration: 20201016

Address after: Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman Islands

Applicant after: Advanced innovation technology Co.,Ltd.

Address before: A four-storey 847 mailbox in Grand Cayman Capital Building, British Cayman Islands

Applicant before: Alibaba Group Holding Ltd.

TA01 Transfer of patent application right
GR01 Patent grant
GR01 Patent grant