CN103116622B - A kind of sequence value generation method for Ibatis scheme and device - Google Patents

A kind of sequence value generation method for Ibatis scheme and device Download PDF

Info

Publication number
CN103116622B
CN103116622B CN201310034787.9A CN201310034787A CN103116622B CN 103116622 B CN103116622 B CN 103116622B CN 201310034787 A CN201310034787 A CN 201310034787A CN 103116622 B CN103116622 B CN 103116622B
Authority
CN
China
Prior art keywords
classkey
node
sql
statement
root node
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.)
Active
Application number
CN201310034787.9A
Other languages
Chinese (zh)
Other versions
CN103116622A (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.)
SHENZHEN LAN-YOU TECHNOLOG Co Ltd
Original Assignee
SHENZHEN LAN-YOU TECHNOLOG Co 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 SHENZHEN LAN-YOU TECHNOLOG Co Ltd filed Critical SHENZHEN LAN-YOU TECHNOLOG Co Ltd
Priority to CN201310034787.9A priority Critical patent/CN103116622B/en
Publication of CN103116622A publication Critical patent/CN103116622A/en
Application granted granted Critical
Publication of CN103116622B publication Critical patent/CN103116622B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the invention discloses a kind of sequence value generation method and device, the method comprises: the key name identifier lookup inputted by user and described key name are identified corresponding structured query sentence and perform object; When the described Structured Query Language (SQL) statement classKey attributes object performed in object is non-NULL, the predefined sequence generator object of dynamic construction, wherein said classKey attributes object is predefinedly utilize the attributes object that the classKey node of java class methods is corresponding; According to the predefined sequence generating method formation sequence value corresponding with described sequence generator.Ibatis major key sequence value generation method can be expanded to certain java class method self-defining, and no longer be only limitted to database mode.

Description

A kind of sequence value generation method for Ibatis scheme and device
Technical field
The present invention relates to computer realm, particularly relate to a kind of sequence value generation method for Ibatis scheme and device.
Background technology
Ibatis mono-word derives from the combination of " internet " and " abatis ", is an open source code project, lays particular emphasis on the exploitation of cipher software at first, is a Persistence Layer Framework based on Java now.The center of effort of Ibatis is the mapping relations between POJO (PlainOldJavaObjects, common Java object) Yu SQL (StructuredQueryLanguage, Structured Query Language (SQL)).That is, Ibatis can't perform for programmer generates SQL automatically in the runtime, and concrete SQL needs programmer to write, and then by Map Profile, by the parameter needed for SQL, and the result field returned is mapped to appointment POJO.
When persistent layer uses Ibatis preservation data to enter database time, usually some sequential values can be used as tables of data major key or data unique identification.In Ibatis framework, complete sequential value mainly through selectKey child node and generate and return, but selectKey is defined as only being confined to the use of database SQL action statement, and not by java class formation sequence value.
Summary of the invention
Embodiment of the present invention technical matters to be solved is, provides a kind of sequence value generation method for Ibatis scheme and device, and easily extensible utilizes non-data storehouse method to generate sequential value.
In order to solve the problems of the technologies described above, embodiments provide a kind of sequence value generation method for Ibatis scheme, comprising:
The key name identifier lookup inputted by user and described key name are identified corresponding structured query sentence and perform object;
When the described Structured Query Language (SQL) statement classKey attributes object performed in object is non-NULL, the predefined sequence generator object of dynamic construction, wherein said classKey attributes object is predefinedly utilize the attributes object that the classKey node of java class methods is corresponding;
According to the predefined sequence generating method formation sequence value corresponding with described sequence generator.
Wherein, described method is further comprising the steps of:
The described key name identifier lookup inputted by user and described key name identify before corresponding Structured Query Language (SQL) statement performs the step of object, detect and load total configuration file;
Read from described total configuration file and resolve predefined tables of data operation file, described tables of data operation file comprises classKey Joint Enterprise;
Resolve the root node in described tables of data operation file, when described root node is classKey node, the Structured Query Language (SQL) statement obtaining described root node performs object;
Utilize < key name to identify, Structured Query Language (SQL) statement performs the list structure of object > to combination and stores described tables of data operation file.
Wherein, described method also comprises:
When described root node is not classKey node, the Structured Query Language (SQL) statement obtaining described root node performs object, and judges whether have child node to be classKey node in described root node;
If there is child node to be classKey node in described root node, resolves described classKey node respectively and classKey corresponding for described classKey node execution object is injected in the Structured Query Language (SQL) statement execution object of described root node;
Utilize < key name to identify, Structured Query Language (SQL) statement performs the list structure of object > to combination and stores described tables of data operation file.
Wherein, described parsing described classKey node classKey corresponding for described classKey node is performed the step that Structured Query Language (SQL) statement that object is injected into described root node performs in object and specifically comprise:
Resolve described classKey node, obtain analysis result object;
Described analysis result object is built and is converted into execution object;
The Structured Query Language (SQL) statement described execution object being injected into described root node performs in object.
Wherein, the attribute of described classKey node comprises rreturn value type resultClass, Property Name keyProperty, type type, the full name className of sequence generator java class and sequence generating method methodName.
Correspondingly, present invention also offers a kind of sequential value generating apparatus for Ibatis scheme, comprising:
Search module, key name identifier lookup and described key name for being inputted by user are identified corresponding structured query sentence and perform object;
Sequence generator builds module, for when the described Structured Query Language (SQL) statement classKey attributes object performed in object is non-NULL, the predefined sequence generator object of dynamic construction, wherein said classKey attributes object is predefinedly utilize the attributes object that the classKey node of java class methods is corresponding;
Sequential value generation module, for the predefined sequence generating method formation sequence value that basis is corresponding with described sequence generator.
Wherein, described sequential value generating apparatus also comprises:
Configuration file load-on module, for detecting and loading total configuration file;
Configuration file parsing module, for reading from described total configuration file and resolving predefined tables of data operation file, described tables of data operation file comprises classKey Joint Enterprise;
Root node parsing module, for resolving the root node in described tables of data operation file, when described root node is classKey node, the Structured Query Language (SQL) statement obtaining described root node performs object;
Memory module, for utilizing < key name to identify, Structured Query Language (SQL) statement performs the list structure of object > to combination and stores described tables of data operation file.
Wherein, described root node parsing module is not also for when described root node is classKey node, and the Structured Query Language (SQL) statement obtaining described root node performs object, and judges whether have child node to be classKey node in described root node;
Described sequential value generating apparatus also comprises:
Injection module, for when there being child node to be classKey node in described root node, resolving described classKey node respectively and classKey corresponding for described classKey node execution object is injected in the Structured Query Language (SQL) statement execution object of described root node.
Wherein, described injection module comprises:
ClassKey parsing module, for resolving described classKey node, obtains analysis result object;
ClassKey performs object and builds module, is converted into execution object for being built by described analysis result object;
ClassKey performs object injection module, performs in object for the Structured Query Language (SQL) statement described execution object being injected into described insert node.
Wherein, the attribute of described classKey node comprises rreturn value type resultClass, Property Name keyProperty, type type, the full name className of sequence generator java class and sequence generating method methodName.
Implement the embodiment of the present invention, there is following beneficial effect: by dynamic construction sequence generator, predefined sequence generating method is utilized to obtain sequential value, Ibatis major key sequence value generation method can be expanded to self-defining certain java class method (i.e. self-defining sequence generator), and no longer be only limitted to database mode.
Accompanying drawing explanation
In order to be illustrated more clearly in the embodiment of the present invention or technical scheme of the prior art, be briefly described to the accompanying drawing used required in embodiment or description of the prior art below, apparently, accompanying drawing in the following describes is only some embodiments of the present invention, for those of ordinary skill in the art, under the prerequisite not paying creative work, other accompanying drawing can also be obtained according to these accompanying drawings.
Fig. 1 is the first embodiment process flow diagram of the sequence value generation method for Ibatis scheme provided by the invention;
Fig. 2 is the operation steps process flow diagram using the sequence value generation method shown in Fig. 1 to be configured document analysis process;
Fig. 3 is the second embodiment process flow diagram of the sequence value generation method for Ibatis scheme provided by the invention;
Fig. 4 is the operation steps process flow diagram using the sequence value generation method shown in Fig. 3 to be configured document analysis process;
Fig. 5 is the first example structure schematic diagram of the sequential value generating apparatus for Ibatis scheme provided by the invention;
Fig. 6 is the second example structure schematic diagram of the sequential value generating apparatus for Ibatis scheme provided by the invention;
Fig. 7 is the 3rd example structure schematic diagram of the sequential value generating apparatus for Ibatis scheme provided by the invention.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present invention, be clearly and completely described the technical scheme in the embodiment of the present invention, obviously, described embodiment is only the present invention's part embodiment, instead of whole embodiments.Based on the embodiment in the present invention, those of ordinary skill in the art, not making the every other embodiment obtained under creative work prerequisite, belong to the scope of protection of the invention.
Refer to Fig. 1, be the first embodiment process flow diagram of the sequence value generation method for Ibatis scheme provided by the invention, comprise:
Step S100, the key name identifier lookup inputted by user are identified corresponding SQL statement with described key name and perform object.Wherein, key name mark can include but not limited to insert, update, delete, procedure, statement, classKey and selectKey.Particularly, when software program or system are in operational process, when needing to call certain tables of data operation file thus perform associative operation, the key name identifier lookup that can be inputted by user and this key name are identified corresponding SQL statement and perform object.
Step S101, when the described Structured Query Language (SQL) statement classKey attributes object performed in object is non-NULL, the predefined sequence generator object of dynamic construction, wherein said classKey attributes object is predefinedly utilize the attributes object that the classKey node of java class methods is corresponding.Particularly, according to the predefined sequence generator object of Java reflex mechanism dynamic construction, the predefined sequence generator object of IOC container (such as springbean) agent object injection mode dynamic construction can also can be utilized.
Step S102, the basis predefined sequence generating method corresponding with described sequence generator obtain sequential value.
Sequence value generation method provided by the invention, by dynamic construction sequence generator, predefined sequence generating method is utilized to obtain sequential value, Ibatis major key sequence value generation method can be expanded to self-defining certain java class method (i.e. self-defining sequence generator), and no longer be only limitted to database mode.
Particularly, in embodiment shown in Fig. 1, if classKey is the key name mark of input, so after formation sequence value, directly this sequential value can be returned to the classKey attributes object in SQL statement execution object as rreturn value, then perform this SQL statement, thus complete operation corresponding to key name mark.If classKey is not the key name mark of input, so after formation sequence value, first this sequential value is returned to the classKey attributes object in SQL statement execution object as rreturn value, then the key name performed in object according to SQL statement identifies corresponding statement (such as insert statement) and builds JDBC (JavaDataBaseConnectivity, java DataBase combining) perform object, parameter according to user's input carries out parameter assignment, then corresponding SQL statement (such as insert statement) is performed, thus operation corresponding to key name mark can be completed.
In addition, if the SQL statement classKey attributes object performed in object is empty, then the direct respective statement performed in object according to SQL statement builds JDBC and performs object, and the parameter according to user's input carries out parameter assignment, then performs this statement.
Before the process completing the formation sequence value shown in Fig. 1, when software program or system start, often need first to load total configuration file, parse execution object, and store, wherein total configuration file is generally XML (ExtensibleMarkupLanguage, extend markup language) form.Refer to Fig. 2, be the operation steps process flow diagram using the sequence value generation method shown in Fig. 1 to be configured document analysis process, comprise:
Step S200, detection load total configuration file.Particularly, when software program or system start, detect and load Ibatis and always configure XML format file.
Step S201, read and resolve predefined tables of data operation file from total configuration file, this tables of data operation file comprises classKey Joint Enterprise.Particularly, the total configuration file of traversal Ibatis, circulation is read predefined tables of data operation file SQLmap and is resolved, and has wherein increased classKey Joint Enterprise newly in tables of data operation file SQLmap.More specifically, except newly-increased classKey Joint Enterprise, in tables of data operation file SQLmap, class ClassKeySource and class ClassKeyStatement has also been pre-defined.Wherein, ClassKeySource is for creating ClassKey analysis result object, and ClassKeyStatement is used for performing object by classKey analysis result Object Creation ClassKey.Such as, the attribute of classKey node comprises rreturn value type resultClass, Property Name keyProperty, type type, the full name className of sequence generator java class and sequence generating method methodName.Alternatively, the attribute of classKey node can also comprise sequence generating method input parameter type paramTypes and sequence generating method input parameter value args, wherein paramTypes and args coupling is corresponding, and paramTypes can comprise any basic data type and character string of supporting Java.In addition, the attribute of ClassKeySource can comprise the full name className of sequence generator java class and sequence generating method methodName, alternatively, sequence generating method input parameter type paramTypes and sequence generating method input parameter value args can also be comprised.The attribute of ClasssKeystatement can comprise ClassKeySource.
Step S202, the root node of resolving in this tables of data operation file, judge whether root node is classKey node.
If the judged result of step S202 is yes, then perform step S203.Step S203, obtain described root node Structured Query Language (SQL) statement perform object.
Step S204, utilize < key name to identify, Structured Query Language (SQL) statement performs the list structure of object > to combination and stores described tables of data operation file.Like this, when performing the method described in Fig. 1, just can resolve according to key name identifier lookup the SQL statement obtained and performing object.
If the judged result of step S202 is no, then perform step S205.Step S205, the Structured Query Language (SQL) statement obtaining described root node perform object, and judge whether have child node to be classKey node in described root node.Such as, if root node is insert node, can resolve insert node in individual data table handling file, perform object with the SQL statement obtaining insert node, the SQL statement under this node is mainly used in data save operation.
If the judged result of step S205 is yes, then perform step S206.Step S206, resolve described classKey node and classKey corresponding for described classKey node is performed the Structured Query Language (SQL) statement that object is injected into described root node and perform in object respectively.Particularly, in Ibatis framework, SQLmap configuration class MappedStatementConfig definition comprises the newly-increased injection process to ClassKeyStatement, therefore, step S202 can comprise: when there is classKey Joint Enterprise in this root node, resolve this classKey node, obtain analysis result object; Analysis result object is built and is converted into execution object; The SQL statement this execution object being injected into this root node performs in object.Following execution step S204.
If the judged result of step S205 is no, then perform step S204.
Refer to Fig. 3, be the second embodiment process flow diagram of the sequence value generation method for Ibatis scheme provided by the invention, comprise:
Step S300, the key name identifier lookup inputted by user are identified corresponding SQL statement with described key name and perform object.
Step S301, judge that this SQL statement performs selectKey attributes object in object whether non-NULL.
If the judged result of step S301 is yes, then perform step S302.SQL statement built-in in step S302, execution selectKey attributes object is to obtain sequential value.
If the judged result of step S301 is no, then perform step S303.Step S303, judge that this SQL statement performs classKey attributes object in object whether non-NULL.
If the judged result of step S303 is yes, then perform step S304.The predefined sequence generator object of step S304, dynamic construction.
Step S305, the basis predefined sequence generating method corresponding with described sequence generator obtain sequential value.
If the judged result of step S303 is no, then this method flow process terminates.
Under normal circumstances, same attribute-name keyProperty only correspond to selectKey attributes object and classKey attributes object one of them.When selectKey attributes object and classKey attributes object have identical attribute-name keyProperty, ordinary priority process selectKey attributes object.When selectKey attributes object is different with the attribute-name keyProperty of classKey attributes object, both process simultaneously.In this way, can expand Ibatis framework use scenes, compatible supporting database and non-data storehouse mode produce the method for sequential value.
In resolving, same attribute-name keyProperty only correspond to selectKey node and classKey node one of them.When selectKey node and classKey node have identical attribute-name keyProperty, ordinary priority process selectKey node.When selectKey node is different with the attribute-name keyProperty of classKey node, both process simultaneously.。
Referring to Fig. 4, is use the sequence value generation method shown in Fig. 3 to be configured the operation steps process flow diagram of document analysis process, take root node as insert node is example, and the method comprises:
Step S400, detection load total configuration file.Particularly, when software program or system start, detect and load Ibatis and always configure XML format file.
Step S401, read and resolve predefined tables of data operation file from total configuration file, this tables of data operation file comprises classKey Joint Enterprise.
Step S402, the insert node of resolving in this tables of data operation file, the SQL statement obtaining this insert node performs object.
Step S403, judge whether to exist in this insert node the configuration of selectKey child node.
If the judged result of step S403 is yes, then perform step S404.Step S404, resolve this selectKey child node and selectKey is performed the SQL statement that object is injected into this insert node and perform in object.
If the judged result of step S403 is no, then perform step S405.Step S405, judge whether to exist in this insert node the configuration of classKey child node.
If the judged result of step S405 is yes, then perform step S406.Step S406, resolve this classKey child node and classKey is performed the SQL statement that object is injected into this insert node and perform in object.
Step S407, utilize < key name to identify, SQL statement performs the list structure of object > to combination and stores described tables of data operation file.
If the judged result of step S405 is no, then jump to step S407.
Refer to Fig. 5, be the first example structure schematic diagram of the sequential value generating apparatus 500 for Ibatis scheme provided by the invention, comprise:
Search module 510, key name identifier lookup and described key name for being inputted by user are identified corresponding SQL statement and perform object.Wherein, key name mark can include but not limited to insert, update, delete, procedure, statement, classKey and selectKey.Particularly, when software program or system are in operational process, when needing to call certain tables of data operation file thus perform associative operation, the key name identifier lookup that can be inputted by user and this key name are identified corresponding SQL statement and perform object.
Sequence generator builds module 520, for when the described Structured Query Language (SQL) statement classKey attributes object performed in object is non-NULL, the predefined sequence generator object of dynamic construction, wherein said classKey attributes object is predefinedly utilize the attributes object that the classKey node of java class methods is corresponding.Particularly, according to the predefined sequence generator object of Java reflex mechanism dynamic construction, the predefined sequence generator object of IOC container (such as springbean) agent object injection mode dynamic construction can also can be utilized.
Sequential value generation module 530, for obtaining sequential value according to the predefined sequence generating method corresponding with described sequence generator.
Sequential value generating apparatus provided by the invention, by dynamic construction sequence generator, predefined sequence generating method is utilized to obtain sequential value, Ibatis major key sequence value generation method can be expanded to self-defining certain java class method (i.e. self-defining sequence generator), and no longer be only limitted to database mode.
Particularly, in embodiment shown in Fig. 5, if classKey is the key name mark of input, after sequential value generation module 530 formation sequence value, directly this sequential value can be returned to the classKey attributes object in SQL statement execution object as rreturn value, so that external program performs this SQL statement, complete the operation that key name mark is corresponding.If classKey is not the key name mark of input, after sequential value generation module 530 formation sequence value, first this sequential value is returned to the classKey attributes object in SQL statement execution object as rreturn value, then the key name performed in object according to SQL statement identifies corresponding statement (such as insert statement) and builds JDBC (JavaDataBaseConnectivity, java DataBase combining) perform object, parameter according to user's input carries out parameter assignment, then corresponding SQL statement (such as insert statement) is performed, thus operation corresponding to key name mark can be completed.
In addition, if the SQL statement classKey attributes object performed in object is empty, then the direct respective statement performed in object according to SQL statement builds JDBC and performs object, and the parameter according to user's input carries out parameter assignment, then performs this statement.
Before the process completing formation sequence value, when software program or system start, often need first to load total configuration file, parse execution object, and store, wherein total configuration file is generally XML format.Referring to Fig. 6, is the structural representation of the sequential value generating apparatus 600 for Ibatis scheme provided by the invention.Sequential value generating apparatus 600 comprises searches module 610, sequence generator structure module 620, sequential value generation module 630, configuration file load-on module 640, configuration file parsing module 650, insert execution object acquisition module 660, classKey injection module 670 and memory module 680.Wherein, search module 610, sequence generator build module 620, sequential value generation module 630 respectively with search module 510, sequence generator builds module 520, sequential value generation module 530 is similar.
Configuration file load-on module 640, for detecting and loading total configuration file.Particularly, when software program or system start, configuration file load-on module 640 detects and loads Ibatis and always configures XML format file.
Configuration file parsing module 650, for reading from total configuration file and resolving predefined tables of data operation file, this tables of data operation file comprises classKey Joint Enterprise.Particularly, configuration file parsing module 650 travels through the total configuration file of Ibatis, and circulation is read predefined tables of data operation file SQLmap and resolved, and has wherein increased classKey Joint Enterprise newly in tables of data operation file SQLmap.More specifically, except newly-increased classKey Joint Enterprise, in tables of data operation file SQLmap, class ClassKeySource and class ClassKeyStatement has also been pre-defined.Wherein, ClassKeySource is for creating ClassKey analysis result object, and ClassKeyStatement is used for performing object by classKey analysis result Object Creation ClassKey.Such as, the attribute of classKey node comprises rreturn value type resultClass, Property Name keyProperty, type type, the full name className of sequence generator java class and sequence generating method methodName.Alternatively, the attribute of classKey node can also comprise sequence generating method input parameter type paramTypes and sequence generating method input parameter value args, wherein paramTypes and args coupling is corresponding, and paramTypes can comprise any basic data type and character string of supporting Java.In addition, the attribute of ClassKeySource can comprise the full name className of sequence generator java class and sequence generating method methodName, alternatively, sequence generating method input parameter type paramTypes and sequence generating method input parameter value args can also be comprised.The attribute of ClasssKeystatement can comprise ClassKeySource.
Root node parsing module 660, for resolving the root node in this tables of data operation file, and judges whether root node is classKey node; If root node is classKey node, then the Structured Query Language (SQL) statement obtaining described root node performs object; If root node is not classKey node, then the Structured Query Language (SQL) statement obtaining described root node performs object, and judges whether have child node to be classKey node in described root node.
Injection module 670, is injected in the Structured Query Language (SQL) statement execution object of described root node for resolving described classKey node respectively and classKey corresponding for described classKey node being performed object.Particularly, in Ibatis framework, SQLmap configuration class MappedStatementConfig definition comprises the newly-increased injection process to ClassKeyStatement, therefore, injection module 670 can comprise: classKey parsing module, for when there is the configuration of classKey child node in this root node, resolve this classKey child node, obtain analysis result object; ClassKey performs object and builds module, is converted into execution object for being built by analysis result object; ClassKey performs object injection module, performs in object for the SQL statement this execution object being injected into this root node.
Memory module 680, for utilizing < key name to identify, SQL statement performs the list structure of object > to combination and stores described tables of data operation file.Like this, search module 610 and just can resolve according to key name identifier lookup the SQL statement execution object obtained.
Referring to Fig. 7, is the structural representation of the sequential value generating apparatus 700 for Ibatis scheme provided by the invention, take root node as insert node is example.Sequential value generating apparatus 700 comprises searches module 710, sequence generator structure module 720, sequential value generation module 730, configuration file load-on module 740, configuration file parsing module 750, root node parsing module 760, injection module 770, memory module 780 and selectKey processing module 790, selectKey injection module 795.Wherein, search module 710, sequence generator build module 720, sequential value generation module 730, configuration file load-on module 740, configuration file parsing module 750, root node parsing module 760, injection module 770, memory module 780 respectively with search module 610, sequence generator builds module 620, sequential value generation module 630, configuration file load-on module 640, configuration file parsing module 650, root node parsing module 660, injection module 670, memory module 680 are similar.
SelectKey processing module 790, for when searching module 710 to search the SQL statement that the obtains selectKey attributes object performed in object being non-NULL, performs SQL statement built-in in selectKey attributes object to obtain sequential value.
SelectKey injection module 795, for when there is the configuration of selectKey child node in the insert node that root node parsing module parses, resolving this selectKey child node and selectKey being performed the SQL statement that object is injected into this insert node and perform in object.
Under normal circumstances, same attribute-name keyProperty only correspond to selectKey attributes object (or selectKey node) and classKey attributes object (or classKey node) one of them.When selectKey attributes object (or selectKey node) and classKey attributes object (or classKey node) have identical attribute-name keyProperty, ordinary priority process selectKey attributes object (or selectKey node).When selectKey attributes object (or selectKey node) is different with the attribute-name keyProperty of classKey attributes object (or classKey node), both process simultaneously.In this way, can expand Ibatis framework use scenes, compatible supporting database and non-data storehouse mode produce the method for sequential value.
One of ordinary skill in the art will appreciate that all or part of flow process realized in above-described embodiment method, that the hardware that can carry out instruction relevant by computer program has come, described program can be stored in a computer read/write memory medium, this program, when performing, can comprise the flow process of the embodiment as above-mentioned each side method.Wherein, described storage medium can be magnetic disc, CD, read-only store-memory body (Read-OnlyMemory, ROM) or random store-memory body (RandomAccessMemory, RAM) etc.
Above disclosedly be only a kind of preferred embodiment of the present invention, certainly the interest field of the present invention can not be limited with this, one of ordinary skill in the art will appreciate that all or part of flow process realizing above-described embodiment, and according to the equivalent variations that the claims in the present invention are done, still belong to the scope that invention is contained.

Claims (8)

1., for a sequence value generation method for Ibatis scheme, it is characterized in that, comprising:
Detect and load total configuration file;
Read from described total configuration file and resolve predefined tables of data operation file, described tables of data operation file comprises classKey Joint Enterprise;
Resolve the root node in described tables of data operation file, when described root node is classKey node, the Structured Query Language (SQL) statement obtaining described root node performs object;
Utilize < key name to identify, Structured Query Language (SQL) statement performs the list structure of object > to combination and stores described tables of data operation file;
The key name identifier lookup inputted by user and described key name are identified corresponding structured query sentence and perform object;
When the described Structured Query Language (SQL) statement classKey attributes object performed in object is non-NULL, the predefined sequence generator object of dynamic construction, wherein said classKey attributes object is predefinedly utilize the attributes object that the classKey node of java class methods is corresponding;
According to the predefined sequence generating method formation sequence value corresponding with described sequence generator.
2., as claimed in claim 1 for the sequence value generation method of Ibatis scheme, it is characterized in that, described method also comprises:
When described root node is not classKey node, the Structured Query Language (SQL) statement obtaining described root node performs object, and judges whether have child node to be classKey node in described root node;
If there is child node to be classKey node in described root node, resolves described classKey node respectively and classKey corresponding for described classKey node execution object is injected in the Structured Query Language (SQL) statement execution object of described root node;
Utilize < key name to identify, Structured Query Language (SQL) statement performs the list structure of object > to combination and stores described tables of data operation file.
3. as claimed in claim 2 for the sequence value generation method of Ibatis scheme, it is characterized in that, the step that the Structured Query Language (SQL) statement that classKey corresponding for described classKey node execution object is injected into described root node performs in object also specifically comprises by described parsing described classKey node:
Resolve described classKey node, obtain analysis result object;
Described analysis result object is built and is converted into execution object;
The Structured Query Language (SQL) statement described execution object being injected into described root node performs in object.
4. the sequence value generation method for Ibatis scheme according to any one of claim 1-3, it is characterized in that, the attribute of described classKey node comprises rreturn value type resultClass, Property Name keyProperty, type type, the full name className of sequence generator java class and sequence generating method methodName.
5., for a sequential value generating apparatus for Ibatis scheme, it is characterized in that, comprising:
Search module, key name identifier lookup and described key name for being inputted by user are identified corresponding structured query sentence and perform object;
Sequence generator builds module, for when the described Structured Query Language (SQL) statement classKey attributes object performed in object is non-NULL, the predefined sequence generator object of dynamic construction, wherein said classKey attributes object is predefinedly utilize the attributes object that the classKey node of java class methods is corresponding;
Sequential value generation module, for the predefined sequence generating method formation sequence value that basis is corresponding with described sequence generator;
Configuration file load-on module, for detecting and loading total configuration file;
Configuration file parsing module, for reading from described total configuration file and resolving predefined tables of data operation file, described tables of data operation file comprises classKey Joint Enterprise;
Root node parsing module, for resolving the root node in described tables of data operation file, when described root node is classKey node, the Structured Query Language (SQL) statement obtaining described root node performs object;
Memory module, for utilizing < key name to identify, Structured Query Language (SQL) statement performs the list structure of object > to combination and stores described tables of data operation file.
6. as claimed in claim 5 for the sequential value generating apparatus of Ibatis scheme, it is characterized in that, described root node parsing module is not also for when described root node is classKey node, the Structured Query Language (SQL) statement obtaining described root node performs object, and judges whether have child node to be classKey node in described root node;
Described sequential value generating apparatus also comprises:
Injection module, for when there being child node to be classKey node in described root node, resolving described classKey node respectively and classKey corresponding for described classKey node execution object is injected in the Structured Query Language (SQL) statement execution object of described root node.
7., as claimed in claim 6 for the sequential value generating apparatus of Ibatis scheme, it is characterized in that, described injection module comprises:
ClassKey parsing module, for resolving described classKey node, obtains analysis result object;
ClassKey performs object and builds module, is converted into execution object for being built by described analysis result object;
ClassKey performs object injection module, performs in object for the Structured Query Language (SQL) statement described execution object being injected into described insert node.
8. the sequential value generating apparatus for Ibatis scheme according to any one of claim 5-7, it is characterized in that, the attribute of described classKey node comprises rreturn value type resultClass, Property Name keyProperty, type type, the full name className of sequence generator java class and sequence generating method methodName.
CN201310034787.9A 2013-01-30 2013-01-30 A kind of sequence value generation method for Ibatis scheme and device Active CN103116622B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201310034787.9A CN103116622B (en) 2013-01-30 2013-01-30 A kind of sequence value generation method for Ibatis scheme and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201310034787.9A CN103116622B (en) 2013-01-30 2013-01-30 A kind of sequence value generation method for Ibatis scheme and device

Publications (2)

Publication Number Publication Date
CN103116622A CN103116622A (en) 2013-05-22
CN103116622B true CN103116622B (en) 2016-03-09

Family

ID=48414995

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201310034787.9A Active CN103116622B (en) 2013-01-30 2013-01-30 A kind of sequence value generation method for Ibatis scheme and device

Country Status (1)

Country Link
CN (1) CN103116622B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107766557A (en) * 2017-11-03 2018-03-06 金蝶软件(中国)有限公司 The generation method and relevant apparatus of a kind of database sequence
CN114096956A (en) * 2019-05-17 2022-02-25 环球数科集团有限公司 Method and device for representing database operation layer

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101004683A (en) * 2007-01-31 2007-07-25 华为技术有限公司 Method and device for accessing database

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2002046921A1 (en) * 2000-12-08 2002-06-13 Fujitsu Limited Sequence analysis method and sequence analysis apparatus

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101004683A (en) * 2007-01-31 2007-07-25 华为技术有限公司 Method and device for accessing database

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
ibatis扩展支持主键生成的方法(非数据库方式);刀光剑影;《CSDN.NET-博客频道》;20121129;1-2 *

Also Published As

Publication number Publication date
CN103116622A (en) 2013-05-22

Similar Documents

Publication Publication Date Title
US10324909B2 (en) Omega names: name generation and derivation utilizing nested three or more attributes
US10162738B2 (en) System, method, and computer readable medium for universal software testing
TWI581188B (en) The way to load the driver and the embedded device
EP3005105B1 (en) Deeply parallel source code compilation
CN106776633B (en) User-configurable apparatus and method for automatically generating a2l file
CN105022739B (en) The storage method and device of data
EP2973047A1 (en) Methods for managing applications using semantic modeling and tagging and devices thereof
CN108549538A (en) A kind of code detection method, device, storage medium and test terminal
CN106844369B (en) Objectification SQL sentence construction method and apparatus
US20140075415A1 (en) Automatic use case generation from a parsed configuration file
CN105630489B (en) Data processing method and data processing equipment
US20120159515A1 (en) Sharing object representations
CN112463135A (en) Code generation method, code generator, electronic device, and storage medium
US9280361B2 (en) Methods and systems for a real time transformation of declarative model and layout into interactive, digital, multi device forms
US8707260B2 (en) Resolving interdependencies between heterogeneous artifacts in a software system
CN116302930A (en) Application testing method and device
CN102193802A (en) Method for converting models with model subsets of same base class structure
CN103116622B (en) A kind of sequence value generation method for Ibatis scheme and device
CN112698819A (en) Method, device and storage medium for designing tree-oriented object programming program
CN112604273B (en) Data-driven game system function loading method, device and storage medium
CN102004633B (en) Method and device for processing control property
US20160062748A1 (en) Embedded domain specific languages as first class code artifacts
CN111125216B (en) Method and device for importing data into Phoenix
CN116432185B (en) Abnormality detection method and device, readable storage medium and electronic equipment
CN115618363B (en) Vulnerability path mining method and related equipment

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant