CN105550261A - IBATIS-based quick search method - Google Patents
IBATIS-based quick search method Download PDFInfo
- Publication number
- CN105550261A CN105550261A CN201510903659.2A CN201510903659A CN105550261A CN 105550261 A CN105550261 A CN 105550261A CN 201510903659 A CN201510903659 A CN 201510903659A CN 105550261 A CN105550261 A CN 105550261A
- Authority
- CN
- China
- Prior art keywords
- ibatis
- attribute
- result
- resultmap
- query
- 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.)
- Withdrawn
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/24—Querying
- G06F16/245—Query processing
- G06F16/2453—Query optimisation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/24—Querying
- G06F16/242—Query formulation
- G06F16/2433—Query languages
Abstract
The invention relates to the field of JAVA technology development, and particularly relates to an IBATIS-based quick search method. The IBATIS-based quick search method comprises the following steps: at first, establishing an object corresponding to a table, and querying corresponding data in a joint query mode; returning a result in a ResultMap mode; and establishing a corresponding relation of a return value and the object through the ResultMap, and classified packaging the results through groupBy attribute, wherein the query and package of one-to-many service are realized by one query sentence. By optimizing the query structure and the return value structure of ibatis, the problem of low query efficiency is solved; and the IBATIS-based quick search method can be applied to IBATIS-based quick search.
Description
Technical field
The present invention relates to JAVA Technical Development Area, be specifically related to a kind of method for quickly retrieving based on IBATIS.
Background technology
At present, in the R&D process of JAVA, IBATIS is the conventional framework of persistent layer.IBATIS provides comparatively complete method for packing, and based on the automatic SQL statement of XML, conveniently can meet miscellaneous service demand and cross-platform demand.But when using the service inquiry of IBATIS process one-to-many, usually there will be N+1 problem.If namely inquire about a teacher, and inquire about this teacher with student time, first IBATIS can inquire about qualified teacher by a SQL statement, recycle teacher list, inquire about respectively this teacher with student.If there are 8 teachers, then need inquiry 9 times.To greatly reduce the performance of platform like this, even cannot meet the high concurrent demand of platform.
Summary of the invention
The technical matters that the present invention solves is to provide a kind of method for quickly retrieving based on IBATIS, to solve N+1 problem.
The technical scheme that the present invention solves the problems of the technologies described above is:
First set up the object corresponding with table, and inquire about corresponding data by the mode of conjunctive query; And result set is returned by the mode of ResultMap; ResultMap completes the corresponding relation of rreturn value and object, and realizes point class wrapper to result by groupBy attribute; Realize by a query statement, to a pair multiple services inquiry and encapsulation.
Described method comprises the steps:
1st step, set up object A, and comprise main attribute, comprising the id attribute of key;
2nd step, set up object B, comprise its all properties; Wherein in B, set up the List collection object of A;
3rd step, establish the table Tb corresponding with B, and determine that attribute id is major key;
4th step, establish the table Ta corresponding with A, the attribute tbid attribute that foundation is associated with the id of Tb in table;
5th step, in IBATIS property file, set up the rreturn value result of ResultMap type, wherein determined the corresponding relation of rreturn value and object A, B by property;
6th step, in result rreturn value, by the classified statistic method of groupBy attribute determination data, wherein groupBy=id;
7th step, correlation inquiry table Ta and Tb, and by Tb.id=Ta.tb_id correlation inquiry, and use result to return results.
The invention has the beneficial effects as follows: by this inquiry and method for packing, inquiry and the encapsulation of data can be realized by a SQL statement, will the I/O operation of system be greatly reduced like this, improve the execution efficiency of platform; And this mode, configuration is very succinct, can complete corresponding corresponding relation by XML, reduces code compilation work, reduces corresponding risk.
Accompanying drawing explanation
Below in conjunction with accompanying drawing, the present invention is further described:
Fig. 1 is process flow diagram of the present invention.
Embodiment
Lower mask body, to educate cloud shared platform, explains the detailed process of this invention in detail.
Education cloud is shared and be there is the information such as teacher, section's group, and wherein each education belongs to some sections group, below by way of the education under inquiry all sections group and section's group.
As shown in Figure 1; Comprise the steps:
1st step, set up object Teacher, comprising id, name attribute;
2nd step, set up object Subject, comprising id, name and set List attribute;
3rd step, establishment table t_subject, comprising id and name field;
4th step, foundation table t_teacher, comprising id, name, subject_id attribute;
5th step, in IBATIS property file, set up the rreturn value result of ResultMap type, groupBy=id really; And determine that data add the incidence relation of rreturn value and object
6th step, to be shown by collection query t_subject and t_teacher, and rreturn value is returned as result.
Claims (2)
1. based on a method for quickly retrieving of IBATIS, it is characterized in that: first set up the object corresponding with table, and inquire about corresponding data by the mode of conjunctive query; And result set is returned by the mode of ResultMap; ResultMap completes the corresponding relation of rreturn value and object, and realizes point class wrapper to result by groupBy attribute; Realize by a query statement, to a pair multiple services inquiry and encapsulation.
2. according to claim 1 based on IBATIS method for quickly retrieving, it is characterized in that: described method comprises the steps:
1st step, set up object A, and comprise main attribute, comprising the id attribute of key;
2nd step, set up object B, comprise its all properties; Wherein in B, set up the List collection object of A;
3rd step, establish the table Tb corresponding with B, and determine that attribute id is major key;
4th step, establish the table Ta corresponding with A, the attribute tb_id attribute that foundation is associated with the id of Tb in table;
5th step, in IBATIS property file, set up the rreturn value result of ResultMap type, wherein determined the corresponding relation of rreturn value and object A, B by property;
6th step, in result rreturn value, by the classified statistic method of groupBy attribute determination data, wherein groupBy=id;
7th step, correlation inquiry table Ta and Tb, and by Tb.id=Ta.tb_id correlation inquiry, and use result to return results.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510903659.2A CN105550261A (en) | 2015-12-09 | 2015-12-09 | IBATIS-based quick search method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510903659.2A CN105550261A (en) | 2015-12-09 | 2015-12-09 | IBATIS-based quick search method |
Publications (1)
Publication Number | Publication Date |
---|---|
CN105550261A true CN105550261A (en) | 2016-05-04 |
Family
ID=55829450
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201510903659.2A Withdrawn CN105550261A (en) | 2015-12-09 | 2015-12-09 | IBATIS-based quick search method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN105550261A (en) |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101004683A (en) * | 2007-01-31 | 2007-07-25 | 华为技术有限公司 | Method and device for accessing database |
CN102053982A (en) * | 2009-11-02 | 2011-05-11 | 阿里巴巴集团控股有限公司 | Method and equipment for managing database information |
US20120290561A1 (en) * | 2011-05-10 | 2012-11-15 | Kenichiro Kobayashi | Information processing apparatus, information processing method, program, and information processing system |
CN103778239A (en) * | 2014-01-28 | 2014-05-07 | 北京京东尚科信息技术有限公司 | Multi-database data management method and system |
-
2015
- 2015-12-09 CN CN201510903659.2A patent/CN105550261A/en not_active Withdrawn
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101004683A (en) * | 2007-01-31 | 2007-07-25 | 华为技术有限公司 | Method and device for accessing database |
CN102053982A (en) * | 2009-11-02 | 2011-05-11 | 阿里巴巴集团控股有限公司 | Method and equipment for managing database information |
US20120290561A1 (en) * | 2011-05-10 | 2012-11-15 | Kenichiro Kobayashi | Information processing apparatus, information processing method, program, and information processing system |
CN103778239A (en) * | 2014-01-28 | 2014-05-07 | 北京京东尚科信息技术有限公司 | Multi-database data management method and system |
Non-Patent Citations (2)
Title |
---|
孙大猛: "基于SOA的网络广告商业系统研究与实现", 《中国优秀硕士学位论文全文数据库 信息科技辑》 * |
段建勇等: "IBATIS框架下文本抽取系统的研究", 《电子科学技术》 * |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN102982076B (en) | Based on the various dimensions content mask method in semantic label storehouse | |
US9317557B2 (en) | Answering relational database queries using graph exploration | |
CN104866593A (en) | Database searching method based on knowledge graph | |
CN108491491B (en) | Method and system for constructing intelligent customer service knowledge graph | |
CN106611044B (en) | SQL optimization method and equipment | |
CN104504008B (en) | A kind of Data Migration algorithm based on nested SQL to HBase | |
CN106407201A (en) | Data processing method and apparatus | |
JP2012234536A (en) | Methods for code generation from semantic models and rules | |
CN103455335A (en) | Multilevel classification Web implementation method | |
CN102650995A (en) | Multi-dimensional data analyzing model generating system and method | |
CN108170752A (en) | metadata management method and system based on template | |
CN104881461A (en) | Rapid data storage method | |
CN106383701A (en) | Common multi-protocol data access interface technology-based data service system | |
CN104601554B (en) | A kind of method for interchanging data and DEU data exchange unit | |
CN109002470A (en) | Knowledge mapping construction method and device, client | |
CN104572894A (en) | Method for describing service model by utilizing XML (Extensible Markup Language) in business intelligence and business intelligence system | |
CN103678396B (en) | A kind of data back up method and device based on data model | |
CN111737364A (en) | Safe multi-party data fusion and federal sharing method, device, equipment and medium | |
CN103678634A (en) | Method for improving data query speed in J-Hi open-source development platform | |
CN108446145A (en) | A kind of distributed document loads MPP data base methods automatically | |
GB2565482A (en) | Attribute matching | |
CN109471957A (en) | A kind of metadata conversion method and device based on unified label | |
KR101955376B1 (en) | Processing method for a relational query in distributed stream processing engine based on shared-nothing architecture, recording medium and device for performing the method | |
CN105574764A (en) | Intellectual property evaluation system | |
CN102799423B (en) | Method and the device of dynamic approach is performed in JSF |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
WW01 | Invention patent application withdrawn after publication | ||
WW01 | Invention patent application withdrawn after publication |
Application publication date: 20160504 |