CN103617167A - Universal metadata/ relation mapping frame - Google Patents

Universal metadata/ relation mapping frame Download PDF

Info

Publication number
CN103617167A
CN103617167A CN 201310500791 CN201310500791A CN103617167A CN 103617167 A CN103617167 A CN 103617167A CN 201310500791 CN201310500791 CN 201310500791 CN 201310500791 A CN201310500791 A CN 201310500791A CN 103617167 A CN103617167 A CN 103617167A
Authority
CN
Grant status
Application
Patent type
Prior art keywords
metadata
step
corresponding
entity
tag
Prior art date
Application number
CN 201310500791
Other languages
Chinese (zh)
Other versions
CN103617167B (en )
Inventor
黄少伟
陈颖
胡平
汪国武
Original Assignee
芜湖大学科技园发展有限公司
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

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F17/00Digital computing or data processing equipment or methods, specially adapted for specific functions
    • G06F17/30Information retrieval; Database structures therefor ; File system structures therefor
    • G06F17/30286Information retrieval; Database structures therefor ; File system structures therefor in structured data stores
    • G06F17/30312Storage and indexing structures; Management thereof
    • G06F17/30339Tablespace storage structures; Management thereof

Abstract

The invention discloses a universal metadata/ relational mapping frame. The universal metadata/ relational mapping frame can be adapted to an existing metadata module of an electric power data management platform. By the adoption of the universal metadata/ relational mapping frame, by means of dynamic proxy, AOP and the like, transparent object-oriented packaging is conducted on operations such as addition, deletion, change and search on the most original metadata, and abilities and features of a relation model are added to the metadata which are stored in the mode of a three-layer HashMap structure at the same time. According to the universal metadata/ relational mapping frame, structural reading and writing operation on the metadata is converted into the object-oriented operation based on the relation model in a seamless mode, the intelligibility and the maintainability of codes of each layer of modules in the electric power data management platform are greatly improved, and the attention of system development and use personnel to the bottom-layer structure of the metadata is effectively reduced.

Description

一种通用的元数据/关系映射框架 A common metadata / relational mapping framework

技术领域 FIELD

[0001] 本发明涉及电力系统数据库领域,具体为一种通用的元数据/关系映射框架。 [0001] The present invention relates to the field of power system database, in particular to a common metadata / relational mapping framework.

背景技术 Background technique

[0002]自律分散的即插即用数据平台采用以三层HashMap形式表示的元数据作为统一结构来存储各种格式的电力数据。 [0002] Plug and play data Autonomous Decentralized platform metadata represented in the form of three HashMap power as a unified structure to store data in various formats. 元数据虽解决了异构数据归一化的问题,但数据平台中下层模块的开发者只能通过调用HashMap所支持的get/put方法并指定Tag/Key名作为参数对元数据进行增、删、改、查等操作,这不仅使模块代码违背了面向对象设计的原则,而且降低了开发者对数据涉及具体业务的关注度。 Although metadata to solve the heterogeneous data normalization issue, but the data platform developers can only lower module supported by calling HashMap get / put methods and specify the Tag / Key name as a parameter metadata to add, delete , change, and other operations, which not only violates the principle of the code module object-oriented design, and reduces the degree of concern relates to developers for specific business data.

发明内容 SUMMARY

[0003] 为了克服上述现有技术的不足,本发明的目的在于提供一种通用的元数据/关系映射框架。 [0003] In order to overcome the disadvantages of the prior art, an object of the present invention is to provide a common metadata / relational mapping framework.

[0004] 为了达到上述目的,本发明所采用的技术方案为: [0004] To achieve the above object, the technical solution employed in the present invention are:

一种通用的元数据/关系映射框架,其特征在于:逻辑结构如下: A common metadata / relational mapping framework, characterized in that: the logical structure as follows:

映射配置的定义,编辑元数据/关系映射所必要的配置信息,配置信息保存在配置文件中; Mapping configuration definition, editing metadata / relational mapping necessary configuration information, the configuration information stored in the configuration file;

实体代理类的生成,根据映射配置信息,生成与元数据中Tag对应的实体代理类的字节码; Entity proxy class is generated, the configuration according to the mapping information, generate metadata corresponding physical Tag proxy class bytecode;

DAO类及其CRUD方法的生成,根据映射配置信息,为元数据各Tag生成对应DAO类的CRUD方法的字节码,用于以面向对象和业务相关的方式对元数据进行增、删、改、查操作;MQL语法分析,对用户提交的类SQL的MQL语句进行语法分析,并提示语法错误信息;结果集封装与迭代,执行用户提交的MQL语句,并将返回结果集封装为实体代理类对象组成的列表以方便后续的迭代操作; And generating CRUD DAO class method, the configuration according to the mapping information, each Tag to generate metadata corresponding method bytecode CRUD DAO classes, as for object-oriented and business-related manner to add, delete metadata, change , check operation; MQL syntax analysis, MQL SQL-statement submitted by the user to parse, and prompt syntax error message; the result set package and iterative execution MQL statement submitted by the user, and returns the result set is packaged as an entity proxy class a list of objects to facilitate the subsequent iterations;

事务管理,对元数据进行更改的过程中,若发生任何错误则自动回滚数据,以保证元数据的数据完整性。 Transaction management, process metadata changes, if any errors occur automatically roll back data to ensure data integrity metadata.

[0005] 所述的一种通用的元数据/关系映射框架,其特征在于:所述映射配置的定义过程如下: [0005] A common metadata according to / relational mapping framework, characterized in that: said mapping configuration is defined as follows:

步骤1:启动映射配置定义模块,选择要操作的元数据格式; Step 1: Start mapping definition module configured to select a metadata format to be operated;

步骤2:定义元数据中的每个Tag对应的实体类名称; Step 2: Tag corresponding to each entity class name is defined in the metadata;

步骤3:定义Tag下的每个Key对应的字段名称和类型; Step 3: Key field names and types of each corresponding to the definition Tag;

步骤4:根据元数据采用的三层HashMap的中层Map,定义其Key值对应的组成字段,以作为后述实体类的主键字段; Step 4: The three middle HashMap Map metadata used, whose composition defined Key field value corresponding to the primary key field as described later, the entity class;

步骤5:分析并校验以上映射配置是否合法。 Step 5: Analyze and verify the legality of the above mapping configuration.

[0006] 所述的一种通用的元数据/关系映射框架,其特征在于:所述实体代理类的生成过程如下: 步骤1:读取映射配置文件,获取实体类及其字段的信息; One kind of [0006] the common metadata / relational mapping framework, characterized in that: the generating process entity proxy class is as follows: Step 1: reading the configuration file mapping, obtain information and entity class field;

步骤2:根据映射配置信息,利用虚拟机字节码生成工具,生成实体类的字节码,包括字段、主键字段、各字段的setter/getter方法; Step 2: according to the mapping configuration information using a virtual machine byte code generation tool, generates bytecode entity classes, including fields, primary key field, each field of the setter / getter methods;

步骤3:结合动态代理模式,为实体类生成代理接口; Step 3: Dynamic binding agent pattern, generates a proxy interface entity class;

步骤4:利用虚拟机字节码生成工具,生成代理接口的实现类。 Step 4: using a virtual machine byte code generation tool, generates a proxy class that implements the interface.

[0007] 所述的一种通用的元数据/关系映射框架,其特征在于:所述DAO类及其CRUD方法的生成过程如下: [0007] A common metadata according to / relational mapping framework, characterized in that: the DAO classes and their methods CRUD generation process is as follows:

步骤1:根据映射配置信息,利用虚拟机字节码生成工具,为元数据各Tag生成对应DAO类的字节码; Step 1: configuration of the mapping information, a virtual machine byte code using a tool, the metadata corresponding to the byte code to generate each of the Tag DAO classes;

步骤2:为实体类各字段生成对应的f indBy方法,其以某个字段的值为查找条件,返回对应Tag下相匹配的记录行构成的实体对象列表; Step 2: f indBy generating method corresponding to each field for the entity class, which is a value of a field of the search condition, the entity corresponding to the object returns a list of rows Tag lower phase matching configuration;

步骤3:生成findByPK方法,其以主键字段的值为查找条件,返回对应Tag下具有相同中层Key值的唯一记录行对应的实体对象; Step 3: findByPK generating method, which is the value of the primary key field search condition, the entity objects corresponding to Tag corresponding unique Key middle rows with the same value;

步骤4:生成findAll方法,其返回对应Tag下所有记录行构成的实体对象列表; Step 4: findAll generating method, which returns a list of all the rows constituting the entity object corresponding to the Tag;

步骤5:生成findByConditions方法,其分别以指定的多个字段值和字段名作为组合查询条件和排序依据,返回对应Tag下相匹配的记录行经过排序后构成的实体对象列表;步骤6:生成update方法,其根据指定的实体对象的主键字段找到对应Tag下具有相同中层Key值的唯一记录行,并使用实体对象的各字段值更新该记录行下的对应Key值;步骤7:生成delete方法,其根据指定的实体对象的主键字段找到对应Tag下具有相同中层Key值的唯一记录行,并删除该记录行; Step 5: The method of generating findByConditions respectively to a plurality of field names and field values ​​as specified sort and a combination of query returns a list of entities corresponding to the object Tag lower phase matching rows constituted by sequencing; Step 6: generating update method to find the primary key field specifies the physical objects unique rows with the same middle key value corresponding lower the Tag, using the fields of physical objects updates the value corresponding to the key value of the recording line; step 7: generating a delete method, which find a unique key middle rows with the same Tag value in the corresponding primary key field specifies the physical objects, and deletes the record line;

步骤8:生成insert方法,其根据指定实体对象所属的实体类找到对应的Tag,并在该Tag下新增一条记录行,该记录行的中层Key值为指定实体对象的主键字段值。 Step 8: The method of generating insert, which belongs to the specified entity class to find the entity object corresponding to the Tag, and add a record in which the Tag line, the middle line of the recording Key is the primary key field value specifies the entity object.

[0008] 所述的一种通用的元数据/关系映射框架,其特征在于:通过框架提供的MQL语法分析、MQL语句执行以及结果集封装逻辑,数据管理平台中下层模块的开发者可编写类SQL语法的MQL语句以直接对元数据进行CRUD操作。 One kind of [0008] the common metadata / relational mapping framework wherein: MQL parse through the frame provided, the MQL statement execution, and result set packing logic, data management platform in the lower module developers can write class SQL syntax MQL statement to the metadata CRUD operations directly.

[0009] 所述的一种通用的元数据/关系映射框架,其特征在于:在对元数据进行增、删、改等写操作时,元数据/关系映射框架通过AOP技术自动维护事务的开启和提交,并在发生任何异常时自动回滚之前已执行的写操作,保证了元数据的完整性和一致性,及降低了事务控制等非功能性代码对业务代码的侵入性,从而有效提升数据管理平台中各下层模块代码的可理解性与可维护性。 One kind of [0009] the common metadata / relational mapping framework, wherein: when the metadata add, delete, change, etc. write operations, the metadata / relational mapping framework by opening AOP art automatic maintenance of transaction and submission, and automatically rolled back before any write operation has been executed in the abnormal occurrence to ensure the integrity and consistency of metadata, and reduces transaction control and other non-functional code business code of invasive, so as to effectively enhance the intelligibility and maintainability of the lower module each of the code data management platform.

[0010] 本发明可无缝适配到电力数据管理平台中现有的元数据模块之上。 [0010] The present invention may be seamlessly adapted to power on the existing data management platform metadata module. 框架借助动态代理和AOP等手段,对最原始的元数据增、删、改、查等操作进行透明封装,为以三层HashMap结构存储的元数据增添了关系模型所具备的能力和特征,具体包括:元数据查询语言MQL (Metadata Query Language)>Tag与实体对象映射配置、元数据CRUD操作的面向对象封装、结果集封装与迭代AP1、事务控制等。 AOP frame means and means of dynamic proxy, the metadata for the most primitive add, delete, change, transparent operations such as encapsulation, adds capabilities and features provided in the relational model of metadata stored in a three-layer structure HashMap, particularly comprising: a package metadata object-oriented query language MQL (metadata query language)> Tag entity configuration object mapping metadata CRUD operations, the result set with package iteration AP1, transaction control.

[0011] 本发明与现有的技术相比,具有如下优点: [0011] Compared with the prior art, it has the following advantages:

(1),框架采用动态代理、字节码生成和AOP等非侵入机制实现,不需要修改现有以HashMap为存储结构的元数据模块的任何代码。 (1), the frame dynamic proxy AOP bytecode generation and other mechanisms to achieve non-invasive, does not need to modify the existing HashMap is any code structure metadata storage module. 框架本身也以OSGi的Bundle形式热插拔到数据管理平台中,所有可配置部分均存放在独立的映射配置文件中。 Bundle frame itself in the form of hot-swap data to the OSGi management platform, all parts are stored in a separate configuration of the mapping profile. [0012] (2),框架在发生任何异常时自动回滚之前已执行的写操作,不仅保证了元数据的完整性和一致性,而且降低了事务控制等非功能性代码对业务代码的侵入性,从而有效提升数据管理平台中各下层模块代码的可理解性与可维护性。 [0012] (2), the frame before the write operation occurs automatically roll back any abnormal executed, not only to ensure the integrity and consistency of metadata, but also reduces the non-functional control transaction codes invasion of the service code , thereby efficiently improve intelligibility and maintainability data management platform of each lower module code.

[0013] (3),使用本框架开发数据管理平台中各下层模时,能以实体对象的方式操作元数据,使得代码逻辑更易于理解,并提升了开发者对数据涉及具体业务的关注度。 [0013] (3), when using each lower die of the present frame development data management platform, operable metadata manner of physical objects, such code logic easier to understand and improve the attention developer of data relating to specific services .

[0014] (4),本框架使得数据管理平台中各下层模块可以遵循标准的Java EE多层架构开发,使得各层代码清晰分离,对电网应用的快速需求变更具有更高的适应性。 [0014] (4), such that each of the lower module of the present frame can follow the standard Java EE multilayer architecture development data management platform, so that the code clear layers were separated, the demand for fast adaptive change grid applications higher.

附图说明 BRIEF DESCRIPTION

[0015] 图1为本发明功能及逻辑划分图。 [0015] FIG. 1 and logic partitioning functions of the present invention FIG.

具体实施方式 detailed description

[0016] 如图1所示。 [0016] As shown in Fig. 一种通用的元数据/关系映射框架,逻辑结构如下: A common metadata / relational mapping framework, the logical structure as follows:

映射配置的定义,编辑元数据/关系映射所必要的配置信息,配置信息保存在配置文件中; Mapping configuration definition, editing metadata / relational mapping necessary configuration information, the configuration information stored in the configuration file;

实体代理类的生成,根据映射配置信息,生成与元数据中Tag对应的实体代理类的字节码; Entity proxy class is generated, the configuration according to the mapping information, generate metadata corresponding physical Tag proxy class bytecode;

DAO类及其CRUD方法的生成,根据映射配置信息,为元数据各Tag生成对应DAO类(Data Access Object)的CRUD (Create、Retrieve、Update、Delete)方法的字节码,用于以面向对象和业务相关的方式对元数据进行增、删、改、查操作; CRUD DAO classes and generating method according to the mapping configuration information to generate metadata corresponding to DAO classes (Data Access Object) each Tag bytecode CRUD (Create, Retrieve, Update, Delete) method for object-oriented and business-related manner metadata to add, delete, change, operation;

MQL语法分析,对用户提交的类SQL的MQL语句进行语法分析,并提示语法错误信息;结果集封装与迭代,执行用户提交的MQL语句,并将返回结果集封装为实体代理类对象组成的列表以方便后续的迭代操作; MQL syntax analysis, MQL SQL-statement submitted by the user to parse, and prompt syntax error message; the result set package and iterative execution MQL statement submitted by the user, and returns a list of result set package for the entity proxy class of objects to facilitate subsequent iterations;

事务管理,对元数据进行更改的过程中,若发生任何错误则自动回滚数据,以保证元数据的数据完整性。 Transaction management, process metadata changes, if any errors occur automatically roll back data to ensure data integrity metadata.

[0017] 映射配置的定义过程如下: Definition process [0017] mapping configuration is as follows:

步骤1:启动映射配置定义模块,选择要操作的元数据格式; Step 1: Start mapping definition module configured to select a metadata format to be operated;

步骤2:定义元数据中的每个Tag对应的实体类名称; Step 2: Tag corresponding to each entity class name is defined in the metadata;

步骤3:定义Tag下的每个Key对应的字段名称和类型; Step 3: Key field names and types of each corresponding to the definition Tag;

步骤4:根据元数据采用的三层HashMap的中层Map,定义其Key值对应的组成字段,以作为后述实体类的主键字段; Step 4: The three middle HashMap Map metadata used, whose composition defined Key field value corresponding to the primary key field as described later, the entity class;

步骤5:分析并校验以上映射配置是否合法。 Step 5: Analyze and verify the legality of the above mapping configuration.

[0018] 实体代理类的生成过程如下: [0018] The proxy class generation process entity as follows:

步骤1:读取映射配置文件,获取实体类及其字段的信息; Step 1: reading the configuration file mapping, obtain information and entity class field;

步骤2:根据映射配置信息,利用虚拟机字节码生成工具,生成实体类的字节码,包括字段、主键字段、各字段的setter/getter方法; Step 2: according to the mapping configuration information using a virtual machine byte code generation tool, generates bytecode entity classes, including fields, primary key field, each field of the setter / getter methods;

步骤3:结合动态代理模式,为实体类生成代理接口; Step 3: Dynamic binding agent pattern, generates a proxy interface entity class;

步骤4:利用虚拟机字节码生成工具,生成代理接口的实现类。 Step 4: using a virtual machine byte code generation tool, generates a proxy class that implements the interface.

[0019] DAO类及其CRUD方法的生成过程如下: 步骤1:根据映射配置信息,利用虚拟机字节码生成工具,为元数据各Tag生成对应DAO类的字节码; [0019] DAO classes and their methods CRUD generation process is as follows: Step 1: according to the mapping configuration information using a virtual machine byte code generation tool for generating metadata corresponding to each byte code DAO classes the Tag;

步骤2:为实体类各字段生成对应的f indBy方法,其以某个字段的值为查找条件,返回对应Tag下相匹配的记录行构成的实体对象列表; Step 2: f indBy generating method corresponding to each field for the entity class, which is a value of a field of the search condition, the entity corresponding to the object returns a list of rows Tag lower phase matching configuration;

步骤3:生成findByPK方法,其以主键字段的值为查找条件,返回对应Tag下具有相同中层Key值的唯一记录行对应的实体对象; Step 3: findByPK generating method, which is the value of the primary key field search condition, the entity objects corresponding to Tag corresponding unique Key middle rows with the same value;

步骤4:生成findAll方法,其返回对应Tag下所有记录行构成的实体对象列表; Step 4: findAll generating method, which returns a list of all the rows constituting the entity object corresponding to the Tag;

步骤5:生成findByConditions方法,其分别以指定的多个字段值和字段名作为组合查询条件和排序依据,返回对应Tag下相匹配的记录行经过排序后构成的实体对象列表;步骤6:生成update方法,其根据指定的实体对象的主键字段找到对应Tag下具有相同中层Key值的唯一记录行,并使用实体对象的各字段值更新该记录行下的对应Key值;步骤7:生成delete方法,其根据指定的实体对象的主键字段找到对应Tag下具有相同中层Key值的唯一记录行,并删除该记录行; Step 5: The method of generating findByConditions respectively to a plurality of field names and field values ​​as specified sort and a combination of query returns a list of entities corresponding to the object Tag lower phase matching rows constituted by sequencing; Step 6: generating update method to find the primary key field specifies the physical objects unique rows with the same middle key value corresponding lower the Tag, using the fields of physical objects updates the value corresponding to the key value of the recording line; step 7: generating a delete method, which find a unique key middle rows with the same Tag value in the corresponding primary key field specifies the physical objects, and deletes the record line;

步骤8:生成insert方法,其根据指定实体对象所属的实体类找到对应的Tag,并在该Tag下新增一条记录行,该记录行的中层Key值为指定实体对象的主键字段值。 Step 8: The method of generating insert, which belongs to the specified entity class to find the entity object corresponding to the Tag, and add a record in which the Tag line, the middle line of the recording Key is the primary key field value specifies the entity object.

[0020] 通过框架提供的MQL语法分析、MQL语句执行以及结果集封装逻辑,数据管理平台中下层模块的开发者可编写类SQL语法的MQL语句以直接对元数据进行CRUD操作。 [0020] provided by the frame parsing MQL, statement execution, and result set MQL packing logic, data management platform in the lower module developers can write statements MQL SQL grammar class to the metadata CRUD operations directly.

[0021] 在对元数据进行增、删、改等写操作时,元数据/关系映射框架通过AOP(Aspect-Oriented Programming)技术自动维护事务的开启和提交,并在发生任何异常时自动回滚之前已执行的写操作,保证了元数据的完整性和一致性,及降低了事务控制等非功能性代码对业务代码的侵入性,从而有效提升数据管理平台中各下层模块代码的可理解性与可维护性。 [0021] When the metadata to add, delete, change, etc. write operations, the metadata / relational mapping framework by AOP (Aspect-Oriented Programming) technology to automatically open and maintain commit transaction, and automatically roll back any abnormality occurs before the write operation has been performed to ensure the integrity and consistency of metadata, and reduces transaction control and other non-functional code business code of invasive, so as to effectively enhance the intelligibility data management platform in each lower module code and maintainability.

[0022] 如图1所示,本发明为一种通用的元数据/关系映射框架,可适配到电力数据管理平台中现有的元数据模块之上。 [0022] As shown in FIG 1, the present invention is a common metadata / relational mapping framework, may be adapted to power on the existing data management platform metadata module. 框架借助动态代理和AOP等手段,对最原始的元数据增、删、改、查等操作进行了透明的面向对象封装,同时为以三层HashMap结构存储的元数据增添了关系模型所具备的能力和特征。 AOP frame means and means of dynamic proxy, the metadata for the most primitive add, delete, change, and other operations were transparent object-oriented packages, as well as metadata stored in a three-layer structure added HashMap relational model provided in capabilities and features.

[0023] 实施例1,生成实体代理类。 [0023] Example 1, the entity generating the proxy class.

[0024] 首先,读取映射配置文件,获取实体类及其字段的信息;然后,根据映射配置信息,利用虚拟机字节码生成工具,生成实体类的字节码,包括字段、主键字段、各字段的setter/getter方法;接着,结合动态代理模式,为实体类生成代理接口;最后,生成代理接口的实现类。 [0024] First, a mapping configuration file is read, and get information entity class field; Then, the configuration according to the mapping information, a virtual machine using a byte code generation tool, generates bytecode entity classes, including fields, primary key field, each field setter / getter methods; Next, the dynamic proxy binding mode, generates a proxy interface entity class; Finally, a proxy class that implements the interface.

[0025] 实施例2,生成实体代理类对应的DAO类及其CRUD方法。 [0025] Example 2, generates Entity CRUD methods DAO class and its corresponding proxy class.

[0026] 首先,根据映射配置信息,利用虚拟机字节码生成工具,为元数据各Tag生成对应DAO类的字节码;然后,为各DAO类生成以字段值为查找条件的f indBy方法、以主键字段为查找条件的findByPK方法、返回对应Tag下所有记录行构成的实体对象列表的findAll方法、以多个字段值和字段名为组合查询条件和排序依据的findByConditions方法;最后,分别生成用于修改、删除和插入实体类对象的update、delete和insert方法。 [0026] First, the configuration according to the mapping information, a virtual machine using a byte code generation tool for generating metadata corresponding to each byte code DAO classes the Tag; then, generates the search criteria field value f indBy method for the DAO classes to the primary key field search criteria findByPK method, the method returns the corresponding entity object findAll all rows in the list consisting of the Tag, and a plurality of field values ​​and field name combination query findByConditions sort method; Finally, generate update to modify, delete and insert the entity class objects, delete, and insert method.

Claims (6)

  1. 1.一种通用的元数据/关系映射框架,其特征在于:逻辑结构如下: 映射配置的定义,编辑元数据/关系映射所必要的配置信息,配置信息保存在配置文件中; 实体代理类的生成,根据映射配置信息,生成与元数据中Tag对应的实体代理类的字节码;DAO类及其CRUD方法的生成,根据映射配置信息,为元数据各Tag生成对应DAO类的CRUD方法的字节码,用于以面向对象和业务相关的方式对元数据进行增、删、改、查操作;MQL语法分析,对用户提交的类SQL的MQL语句进行语法分析,并提示语法错误信息;结果集封装与迭代,执行用户提交的MQL语句,并将返回结果集封装为实体代理类对象组成的列表以方便后续的迭代操作; 事务管理,对元数据进行更改的过程中,若发生任何错误则自动回滚数据,以保证元数据的数据完整性。 A common metadata / relational mapping framework, characterized in that: the following logical structure: mapping definitions configuration, editing metadata / relational mapping necessary configuration information, the configuration information stored in the configuration file; entity proxy class generating, according to the mapping configuration information, generate metadata corresponding physical Tag proxy class byte code; CRUD DAO classes and generating method according to the mapping configuration information to the metadata generation method CRUD DAO classes corresponding to the respective Tag byte code, for object-oriented manner and business-related metadata add, delete, change, operation; MQL syntax analysis, classes of users submitted MQL SQL statement parsing a syntax error message and prompt; result set with package iterations performed MQL user submits the statement, and returns a list of the result set for the entity encapsulation proxy class objects to facilitate subsequent iterations; transaction management, process changes the metadata, if any errors occurred automatically rollback data to ensure data integrity metadata.
  2. 2.根据权利要求1所述的一种通用的元数据/关系映射框架,其特征在于:所述映射配置的定义过程如下: 步骤1:启动映射配置定义模块,选择要操作的元数据格式; 步骤2:定义元数据中的每个Tag对应的实体类名称; 步骤3:定义Tag下的每个Key对应的字段名称和类型; 步骤4:根据元数据采用的三层HashMap的中层Map,定义其Key值对应的组成字段,以作为后述实体类的主键字段; 步骤5:分析并校验以上映射配置是否合法。 The one of the common metadata 1 / relational mapping framework claim, wherein: said mapping configuration is defined as follows: Step 1: Start mapping definition module configured to select a metadata format to be operated; step 2: Tag corresponding to each entity class name is defined in the metadata; step 3: Key field names and types of each corresponding to the definition Tag; step 4: according to the metadata is three HashMap middle Map, defined key component fields corresponding to the value which, as described later, the primary key field of the entity class; step 5: analysis and mapping verify the above configuration is valid.
  3. 3.根据权利要求1所述的一种通用的元数据/关系映射框架,其特征在于:所述实体代理类的生成过程如下: 步骤1:读取映射配置文件,获取实体类及其字段的信息; 步骤2:根据映射配置信息,利用虚拟机字节码生成工具,生成实体类的字节码,包括字段、主键字段、各字段的setter/getter方法; 步骤3:结合动态代理模式,为实体类生成代理接口; 步骤4:利用虚拟机字节码生成工具,生成代理接口的实现类。 1 according to one of said common metadata / relational mapping framework claim, wherein: the generating process entity proxy class is as follows: Step 1: reading the mapping configuration file, and acquires the entity class field information; step 2: according to the mapping configuration information using a virtual machine byte code generation tool, generates bytecode entity classes, including fields, primary key field, each field of the setter / getter methods; step 3: dynamic binding agent model for generating a proxy interface entity class; step 4: using a virtual machine byte code generation tool, generates a proxy class that implements the interface.
  4. 4.根据权利要求1所述的一种通用的元数据/关系映射框架,其特征在于:所述DAO类及其CRUD方法的生成过程如下: 步骤1:根据映射配置信息,利用虚拟机字节码生成工具,为元数据各Tag生成对应DAO类的字节码; 步骤2:为实体类各字段生成对应的findBy方法,其以某个字段的值为查找条件,返回对应Tag下相匹配的记录行构成的实体对象列表; 步骤3:生成findByPK方法,其以主键字段的值为查找条件,返回对应Tag下具有相同中层Key值的唯一记录行对应的实体对象; 步骤4:生成findAll方法,其返回对应Tag下所有记录行构成的实体对象列表;步骤5:生成findByConditions方法,其分别以指定的多个字段值和字段名作为组合查询条件和排序依据,返回对应Tag下相匹配的记录行经过排序后构成的实体对象列表;步骤6:生成update方法,其根据指定的实体对象的主键字段找到对应Tag下具 1, according to one of the common metadata / relational mapping framework claim, wherein: the DAO classes and their methods CRUD generation process is as follows: Step 1: according to the mapping configuration information using a virtual machine byte code generating means, the metadata generated byte code corresponding to each of the DAO classes Tag; step 2: a method of generating a corresponding findBy entity class fields, which is the value of a field of search conditions, returns the corresponding lower phase matching Tag entity list objects rows constituted; step 3: generating findByPK method, which is the value of the search criteria primary key field, returns the unique rows corresponding to the same middle key value corresponding lower Tag entity object; step 4: generating findAll method, Object returns a list of entities corresponding to all the rows Tag configuration; step 5: the method of generating findByConditions respectively to a plurality of field names and field values ​​as specified query and sort combinations, corresponding to rows returned lower phase matching Tag configuration entity object list after sorting; step 6: generating update method according to the specified primary key field to find the corresponding physical objects with the Tag 有相同中层Key值的唯一记录行,并使用实体对象的各字段值更新该记录行下的对应Key值;步骤7:生成delete方法,其根据指定的实体对象的主键字段找到对应Tag下具有相同中层Key值的唯一记录行,并删除该记录行; 步骤8:生成insert方法,其根据指定实体对象所属的实体类找到对应的Tag,并在该Tag下新增一条记录行,该记录行的中层Key值为指定实体对象的主键字段值。 The only rows have the same middle Key value, and uses the entity object field values ​​updates the corresponding Key value in the recording line; Step 7: generating a delete method to find the corresponding lower Tag has the same according to the specified physical objects primary key field Key value unique middle rows, row and delete the record; step 8: the method of generating insert, which belongs to the specified entity class to find the entity object corresponding to the Tag, and add a record in which the Tag line, the recording line key middle value of the specified physical objects primary key field value.
  5. 5.根据权利要求1所述的一种通用的元数据/关系映射框架,其特征在于:通过框架提供的MQL语法分析、MQL语句执行以及结果集封装逻辑,数据管理平台中下层模块的开发者可编写类SQL语法的MQL语句以直接对元数据进行CRUD操作。 1 according to one of the common metadata / relational mapping framework claim, wherein: MQL framework provided by parsing, statement execution, and the MQL packing logic result set, the data management platform of the lower module developers You can write SQL-like syntax MQL statement to the metadata CRUD operations directly.
  6. 6.根据权利要求1所述的一种通用的元数据/关系映射框架,其特征在于:在对元数据进行增、删、改等写操作时,元数据/关系映射框架通过AOP技术自动维护事务的开启和提交,并在发生任何异常时自动回滚之前已执行的写操作,保证了元数据的完整性和一致性,及降低了事务控制等非功能性代码对业务代码的侵入性,从而有效提升数据管理平台中各下层模块代码的可理解性与可维护性。 1 according to one of the common metadata / relational mapping framework claim, wherein: when the metadata add, delete, change, etc. write operations, the metadata / relational mapping framework through automatic maintenance of AOP open and commit the transaction and before any write operations are automatically rolled back when an exception has been executed in the event, to ensure the integrity and consistency of metadata, and reduces transaction control and other non-functional code business code of invasive, so as to effectively enhance the understandability and maintainability data management platform of each lower module code.
CN 201310500791 2013-10-22 2013-10-22 A common metadata / relational mapping framework CN103617167B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN 201310500791 CN103617167B (en) 2013-10-22 2013-10-22 A common metadata / relational mapping framework

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN 201310500791 CN103617167B (en) 2013-10-22 2013-10-22 A common metadata / relational mapping framework

Publications (2)

Publication Number Publication Date
CN103617167A true true CN103617167A (en) 2014-03-05
CN103617167B CN103617167B (en) 2017-05-31

Family

ID=50167870

Family Applications (1)

Application Number Title Priority Date Filing Date
CN 201310500791 CN103617167B (en) 2013-10-22 2013-10-22 A common metadata / relational mapping framework

Country Status (1)

Country Link
CN (1) CN103617167B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104361425A (en) * 2014-10-14 2015-02-18 许继电气股份有限公司 Intelligent substation panoramic information comprehensive integrating and display method based on proxy

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060195460A1 (en) * 2005-02-28 2006-08-31 Microsoft Corporation Data model for object-relational data
CN1869991A (en) * 2006-06-30 2006-11-29 南京联创科技股份有限公司 Implement method of data access object mode based on dynamic proxy
CN102004634A (en) * 2009-09-01 2011-04-06 上海杉达学院 Hierarchical business management system

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060195460A1 (en) * 2005-02-28 2006-08-31 Microsoft Corporation Data model for object-relational data
CN1869991A (en) * 2006-06-30 2006-11-29 南京联创科技股份有限公司 Implement method of data access object mode based on dynamic proxy
CN102004634A (en) * 2009-09-01 2011-04-06 上海杉达学院 Hierarchical business management system

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
CHAO-LIN WU 等: "Service-Oriented Smart-Home Architecture Based on OSGi and Mobile-Agent Technology", 《IEEE TRANSACTIONS ON SYSTEMS, MAN, AND CYBERNETICS—PART C: APPLICATIONS AND REVIEWS》, vol. 37, no. 2, 31 March 2007 (2007-03-31), pages 193 - 205, XP011168355, DOI: doi:10.1109/TSMCC.2006.886997 *
谭待 等: "基于Spring与Hibernate的J2EE持久层解决方案", 《铁路计算机应用》, vol. 16, no. 10, 31 December 2007 (2007-12-31), pages 41 - 44 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104361425A (en) * 2014-10-14 2015-02-18 许继电气股份有限公司 Intelligent substation panoramic information comprehensive integrating and display method based on proxy

Also Published As

Publication number Publication date Type
CN103617167B (en) 2017-05-31 grant

Similar Documents

Publication Publication Date Title
US8032544B2 (en) Methods and apparatus for generating dynamic program files based on input queries that facilitate use of persistent query services
US8150882B2 (en) Mapping from objects to data model
US20060242563A1 (en) Optimizing XSLT based on input XML document structure description and translating XSLT into equivalent XQuery expressions
US7694272B2 (en) Method, a language and a system for the definition and implementation of software solutions by using a visualizable computer executable modeling language
US20040230559A1 (en) Information processing device and information processing method
US6023578A (en) Systems, methods and computer program products for generating an object oriented application for an object oriented environment
US20080276229A1 (en) Incremental model refinement and transformation in generating commerce applications using a model driven architecture
US20030163479A1 (en) Method and apparatus for implementing a data management system using a metadata specification
US20120110437A1 (en) Style and layout caching of web content
US20070174763A1 (en) System and method for developing and enabling model-driven XML transformation framework for e-business
US20080270980A1 (en) Rapid application development for database-aware applications
US20050108684A1 (en) Method and system for generating an application object repository from application framework metadata
CN101114226A (en) Code automatically generating device based on model component, system and method
CN101334728A (en) Interface creating method and platform based on XML document description
CN101067814A (en) Mapping conversion method between data access level Xml format data and relational data
CN101021875A (en) Object-oriented data bank access method and system
CN101706773A (en) Method for realizing fast and automatic modeling of transformer substation IEC 61850 by adopting XML information recombination
CN101645074A (en) Method for accessing relational databases of different types
US20070143321A1 (en) Converting recursive hierarchical data to relational data
US20120030180A1 (en) Archive-system-independent archive-type objects
CN101515245A (en) Operation log recording method and system
US20130275369A1 (en) Data record collapse and split functionality
CN102646039A (en) Software interface generating system and method based on extensible markup language (XML) Schema
CN101650712A (en) Generating management method and system of self-defined report
CN101739453A (en) Method and device for carrying out condition query on database table

Legal Events

Date Code Title Description
C10 Entry into substantive examination
GR01