CN105718556B - Database purchase and querying method, attribute value-acquiring method and equipment - Google Patents

Database purchase and querying method, attribute value-acquiring method and equipment Download PDF

Info

Publication number
CN105718556B
CN105718556B CN201610035963.4A CN201610035963A CN105718556B CN 105718556 B CN105718556 B CN 105718556B CN 201610035963 A CN201610035963 A CN 201610035963A CN 105718556 B CN105718556 B CN 105718556B
Authority
CN
China
Prior art keywords
mongodb
attribute value
attribute
mysql
database
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
CN201610035963.4A
Other languages
Chinese (zh)
Other versions
CN105718556A (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.)
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology 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 Beijing Jingdong Century Trading Co Ltd, Beijing Jingdong Shangke Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN201610035963.4A priority Critical patent/CN105718556B/en
Publication of CN105718556A publication Critical patent/CN105718556A/en
Application granted granted Critical
Publication of CN105718556B publication Critical patent/CN105718556B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/18File system types
    • G06F16/182Distributed file systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/28Databases characterised by their database models, e.g. relational or object models
    • G06F16/284Relational databases

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The present invention provides a kind of database purchases and querying method, attribute value-acquiring method and equipment.According to the present invention, the MongoDB attribute value of Java object is stored together with the Mysql major key ID of Java object.In inquiry, if query object contains MongoDB attribute, the code of on-demand loading is generated, and the code is assembled into agent object as query result object together with Mysql attribute value.When obtaining attribute value, the code of the on-demand loading is called, obtains corresponding MongoDB attribute value from MongoDB database.

Description

Database purchase and querying method, attribute value-acquiring method and equipment
Technical field
Present invention relates in general to database fields, more particularly to a kind of database purchase and querying method, attribute value Acquisition methods and equipment.More particularly it relates to a kind of database purchase of unified Mysql and MongoDB access mode With querying method, attribute value-acquiring method and equipment.
Background technique
Mysql is a kind of Relational DBMS, is saved the data in different tables, usually web system It unites most important persistence tool.MongoDB is the database based on distributed document storage, is non-relational database Function is most abundant in the middle, most like with relevant database.In web system, long text field usually is accessed with Mongo (that is, character length is greater than 255 field).
When writing java applet, it is often necessary to while inquiring the data of Mysql and MongoDB.The prior art is usually adopted Using the following method: firstly, being stored in using Java Annotation (hereinafter referred to as " Annotation ") technology to needs The Java attribute of MongoDB makes marks;Then, residue is needed to be mapped to the good iBatis ORM of Java attribute configuration of Mysql The configuration file of frame;Finally, using specified API (Application Programming when writing Dao layer identification code Interface, application programming interface) inquiry data, realize the assembling of data.IBatis ORM frame used herein is One becomes Java object and attribute mapping one mapping framework recorded with field of database.
Fig. 1 shows the specific implementation step of the prior art.As shown in Figure 1, calling API to inquire number in step S110 According to.In step S120, corresponding iBatis configuration file is found according to the Java entity of inquiry, data are inquired from Mysql. Judge whether current Java entity has the attribute for belonging to MongoDB using Java Annotation technology in step S130, if Have, proceed to step S140, if nothing, proceeds to step S170, returned data terminates inquiry.In step S140, reuse Java Annotation technology gets the MongoDB attribute list in entity.In step S150, inquired from MongoDB Associated data.In step S160, the Mysql and MongoDB data inquired are assembled.In step S170, returned data terminates Inquiry.
Prior art default in each inquiry can come out the reading data being stored in MongoDB, Bu Nengling Control living obtains the opportunity of MongoDB attribute, causes the reading frequency of MongoDB data very high, inquiry time delay obviously increases.
Summary of the invention
One aspect of the present invention provides a kind of database storage method, comprising: according to corresponding with Java object IBatis configuration file stores the Mysql attribute value in Java object to Mysql database, and obtains the Java object and exist Mysql major key ID in Mysql database;Whether determine has the MongoDB that store MongoDB database in Java object Attribute value;If there is no the MongoDB attribute value that store MongoDB database in Java object, terminate this storage; And if there is the MongoDB attribute value that store MongoDB database in Java object, storing MongoDB The MongoDB attribute value of database is stored in MongoDB database together with the Mysql major key ID of the Java object, terminates this Secondary storage, wherein the affiliated MongoDB attribute of MongoDB attribute value is corresponding with the agent object as query result object, described Agent object includes Mysql attribute value and on-demand loading code, the on-demand loading code when called, according to what is be queried The Mysql major key ID of Java object inquires MongoDB attribute value from MongoDB database to return to MongoDB attribute value.
Optionally, it determines whether to have in Java object according to Java Annotation technology and to store MongoDB data Attribute value and the determining attribute value in library.
Another aspect of the present invention provides a kind of data base query method, comprising: according to the Java entity with inquiry Mysql attribute value in corresponding iBatis configuration file inquiry Mysql database;Determine in Java entity whether contain MongoDB attribute;If not containing MongoDB attribute in Java entity, inquiry is returned to based on the Mysql attribute value inquired Result object;And if containing MongoDB attribute in Java entity, generate press corresponding with the MongoDB attribute Loading code is needed, and Mysql attribute value and on-demand loading code are assembled into agent object, and returns to the agent object conduct Query result object, wherein the on-demand loading code when called, according to the Mysql major key for the Java object being queried ID inquires MongoDB attribute value from MongoDB database to return to MongoDB attribute value.
Optionally, determine in Java entity whether contain MongoDB attribute using Java Annotation technology;And/ Or the on-demand loading code is generated using CGLIB technology.
Another aspect of the present invention provides a kind of from according to query result object acquisition attribute value as described above Method, comprising: whether the determination attribute value to be obtained corresponds to MongoDB attribute;If the attribute value to be obtained does not correspond to MongoDB attribute then returns to the attribute value;And if the attribute value to be obtained corresponds to MongoDB attribute, according to inquiry Result object inquires the attribute value in major key ID to the MongoDB database in Mysql and returns to the attribute value.
Optionally, if the attribute value to be obtained corresponds to MongoDB attribute, judge whether the attribute value is sky, such as The fruit attribute value is sky, then inquires the attribute in major key ID to the MongoDB database according to query result object in Mysql It is worth and returns to the attribute value, otherwise directly returns to the attribute value.
Optionally, this method further include: the MongoDB attribute value inquired is assigned to corresponding MongoDB attribute.
Another aspect of the present invention provides a kind of database storage device, comprising: for basis and Java object phase Corresponding iBatis configuration file stores the Mysql attribute value in Java object to Mysql database, and obtains this Java pairs As the device of the Mysql major key ID in Mysql database;MongoDB is stored for determining whether to have in Java object The device of the attribute value of database;If tied for not having to store the attribute value of MongoDB database in Java object The device of Shu Benci storage;And if for there is the attribute value that store MongoDB database in Java object, wanting The attribute value for storing MongoDB database is stored in MongoDB database together with the Mysql major key ID of the Java object, Terminate the device of this storage, wherein the affiliated MongoDB attribute of MongoDB attribute value is corresponding with as query result object Agent object, the agent object include Mysql attribute value and on-demand loading code, and the on-demand loading code is called When, inquire MongoDB attribute value from MongoDB database according to the Mysql major key ID for the Java object being queried to return MongoDB attribute value.
Optionally, it determines whether to have in Java object according to Java Annotation technology and to store MongoDB data Attribute value and the determining attribute value in library.
Another aspect of the present invention provides a kind of database inquiry facility, comprising: for according to the Java with inquiry The device of Mysql attribute value in the corresponding iBatis configuration file inquiry Mysql database of entity;For determining Java reality In body whether the device containing MongoDB attribute;If for not containing MongoDB attribute in Java entity, based on inquiry The Mysql attribute value arrived returns to the device of query result object;And if for containing MongoDB attribute in Java entity, Then generate the device of corresponding with MongoDB attribute on-demand loading code, and by Mysql attribute value and on-demand loading Code is assembled into agent object, and returns to the agent object as query result object, wherein the on-demand loading code is in quilt When calling, inquired from MongoDB database according to the Mysql major key ID for the Java object being queried MongoDB attribute value with Return to MongoDB attribute value.
Optionally, determine in Java entity whether contain MongoDB attribute using Java Annotation technology;And/ Or the on-demand loading code is generated using CGLIB technology.
Another aspect of the present invention provides a kind of equipment from query result object acquisition attribute value as described above, It include: whether to correspond to the device of MongoDB attribute for the determination attribute value to be obtained;If for the attribute value to be obtained MongoDB attribute is not corresponded to, then returns to the device of the attribute value;And if corresponded to for the attribute value to be obtained MongoDB attribute then inquires the attribute value in major key ID to the MongoDB database according to query result object in Mysql And return to the device of the attribute value.
Optionally, if the attribute value to be obtained corresponds to MongoDB attribute, judge whether the attribute value is sky, such as The fruit attribute value is sky, then inquires the attribute in major key ID to the MongoDB database according to query result object in Mysql It is worth and returns to the attribute value, otherwise directly returns to the attribute value.
Optionally, equipment further include: the MongoDB attribute value for will inquire is assigned to corresponding MongoDB and belongs to The device of property.
Detailed description of the invention
For a more complete understanding of the present invention and its advantage, referring now to being described below in conjunction with attached drawing, in which:
Fig. 1 diagrammatically illustrates Mysql and the MongoDB querying method of the prior art.
Fig. 2 diagrammatically illustrates database storage method according to an embodiment of the present invention.
Fig. 3 diagrammatically illustrates data base query method according to an embodiment of the present invention.
Fig. 4 is diagrammatically illustrated according to embodiments of the present invention from the method for query result object acquisition attribute value.
Specific embodiment
According in conjunction with attached drawing to the described in detail below of exemplary embodiment of the present, other aspects of the invention, advantage Those skilled in the art will become obvious with prominent features.
In the present invention, term " includes " and " containing " and its derivative mean including rather than limit;Term "or" is packet Containing property, mean and/or.
In the present specification, following various embodiments for describing the principle of the invention only illustrate, should not be with any Mode is construed to the range of limitation invention.Referring to attached drawing the comprehensive understanding described below that is used to help by claim and its equivalent The exemplary embodiment of the present invention that object limits.Described below includes a variety of details to help to understand, but these details are answered Think to be only exemplary.Therefore, it will be appreciated by those of ordinary skill in the art that without departing substantially from scope and spirit of the present invention In the case where, embodiment described herein can be made various changes and modifications.In addition, for clarity and brevity, The description of known function and structure is omitted.In addition, running through attached drawing, same reference numbers are used for identity function and operation.
The invention proposes a kind of methods of on-demand loading MongoDB attribute value.According to an embodiment of the invention, only needing Respective attributes value is just loaded when using MongoDB attribute value, is reduced while improving the search efficiency of data The load of MongDB.
According to an embodiment of the invention, generating query result pair after inquiry database returns to the attribute value that inquiry obtains As preceding, by Annotation technology judge query entity whether the attribute containing MongoDB.If query entity contains The attribute of MongoDB then first passes through AOP (Aspect Oriented Programming, face according to the attribute value that inquiry obtains To tangent plane programming) technology generate agent object, in the method for agent object increase on-demand loading method, finally assemble again from The attribute value inquired in Mysql returns to agent object.The attribute obtained at this time containing Mysql in inquiry in agent object Value, and correspond to the code that the attribute being stored in MongoDB only has one section of on-demand loading.Here AOP technology is by pre- Compiling mode and runtime dynamic proxy realize a kind of technology of the unified maintenance of program function.AOP technology is Spring frame In content, be functional expression programming a kind of derivative pattern.Using AOP technology can to the various pieces of service logic carry out every From improving the reusability of program, while improving exploitation so that the degree of coupling between service logic each section reduces Efficiency.
Next, then can first be triggered when agent object calls the correlation technique of MongoDB attribute in use It states on-demand loading method to go to load the attribute value in corresponding MongoDB, then returns again to query result.
Fig. 2 diagrammatically illustrates database storage method according to an embodiment of the present invention.As shown in Fig. 2, the storage method Start from step S210.It, will be in Java object according to iBatis configuration file corresponding with Java object in step S220 Mysql attribute value is stored into Mysql database, and obtains Mysql major key ID of the object in Mysql database.Then, In step S230, determine whether there is the attribute that store MongoDB database in Java object by Annotation technology Value, if so, then method proceeds to step S240, otherwise proceeds to step S260, terminates this storage.In step S240, lead to It crosses Annotation technology and determines the attribute value that store MongoDB database in Java object.Then, in step S250 is deposited into the attribute value that store MongoDB database together with the Mysql major key ID that step S220 is obtained In MongoDB.Then, this method proceeds to step S260, terminates this storage.
Fig. 3 diagrammatically illustrates data base query method according to an embodiment of the present invention.The querying method starts from step S310.In step S320, inquired in Mysql database according to iBatis configuration file corresponding with the Java entity of inquiry Attribute value.In step S330, by Annotation check-up Java entity whether the attribute containing MongoDB, if Have, then method proceeds to step S340, otherwise proceeds to step S350, returns to inquiry knot based on the Mysql attribute value inquired Fruit object simultaneously terminates to inquire.In step S340, in on-demand loading generation corresponding with the MongoDB attribute, is generated by CGLIB Code.Here CGLIB is a code building class libraries, it can pass through the function of bytecode modification technology extension class in the runtime Energy.It is, for example, possible to use CGLIB by way of inheriting target class dynamic creation Bean, extends java class method, realizes AOP Programming.Then, in step S350, Mysql attribute value and on-demand loading code are assembled into agent object, and return to the agency couple As query result object.
Fig. 4 is diagrammatically illustrated according to embodiments of the present invention from the method for query result object acquisition attribute value.This method Start from step S410.In step S420, whether corresponded to using the Annotation technology determination attribute value to be obtained The attribute of MongoDB.If the attribute value to be obtained does not correspond to the attribute of MongoDB, method proceeds to step S450, returns It returns attribute value and terminates.If the attribute value to be obtained corresponds to the attribute of MongoDB, method proceeds to step S430, sentences Whether the attribute value that breaks is empty.If attribute value is not sky, illustrate to have loaded the attribute value, method proceeds to step S450, return attribute value simultaneously terminate.If the attribute value is sky, method proceeds to step S440, according to query result object Querying attributes value in major key ID to MongoDB database in Mysql, and it is assigned to corresponding MongoDB attribute, it avoids down It goes to inquire data in MongoDB again when secondary use.Then, method proceeds to step S450, and return attribute value simultaneously terminates.
The embodiment provides a kind of database storage devices, comprising: for according to corresponding with Java object IBatis configuration file the Mysql attribute value in Java object is stored to Mysql database, and obtain the Java object and exist The device of Mysql major key ID in Mysql database;MongoDB data are stored for determining whether to have in Java object The device of the attribute value in library;If terminating this for not having to store the attribute value of MongoDB database in Java object The device of secondary storage;And if for there is the attribute value that store MongoDB database in Java object, storing Attribute value to MongoDB database is stored in MongoDB database together with the Mysql major key ID of the Java object, is terminated The device of this storage.
According to an embodiment of the invention, determining whether have in Java object and to store according to Java Annotation technology To the attribute value in MongoDB database and determine the attribute value.
The embodiment provides a kind of database inquiry facilities, comprising: for according to the Java entity with inquiry The device of Mysql attribute value in corresponding iBatis configuration file inquiry Mysql database;For determining in Java entity Whether the device containing MongoDB attribute;If for not containing MongoDB attribute in Java entity, based on what is inquired The device of Mysql attribute value return query result object;And if for containing MongoDB attribute in Java entity, given birth to At the device of on-demand loading code corresponding with the MongoDB attribute, the on-demand loading code when called, according to The Mysql major key ID for the Java object being queried inquires MongoDB attribute value from MongoDB database, and Mysql is belonged to Property value and on-demand loading code are assembled into agent object, and return to the agent object as query result object.
According to an embodiment of the invention, determining in Java entity whether contain using Java Annotation technology MongoDB attribute;And/or the on-demand loading code is generated using CGLIB technology.
The embodiment provides a kind of equipment for from above-mentioned query result object acquisition data, the equipment packets It includes: whether corresponding to the device of the attribute of MongoDB for the determination attribute value to be obtained;If for the attribute value to be obtained The attribute of MongoDB is not corresponded to, then returns to the device of the attribute value;And if corresponded to for the attribute value to be obtained The attribute of MongoDB then inquires the attribute in major key ID to the MongoDB database according to query result object in Mysql It is worth and returns the device of the attribute value.
According to an embodiment of the invention, judging the attribute if the attribute value to be obtained corresponds to the attribute of MongoDB Whether value is empty, if the attribute value is sky, according to major key ID to MongoDB data of the query result object in Mysql The attribute value is inquired in library and returns to the attribute value, otherwise directly returns to the attribute value.
According to an embodiment of the invention, the equipment further include: the MongoDB attribute value for will inquire is assigned to accordingly MongoDB attribute device.
It is saturating to user the embodiment provides a kind of mode of fusion Mysql and MongoDB access data Bright, user does not need the field how concern loads MongoDB, it is only necessary to do simple attribute-bit.In transparent fusion On the basis of the access mode of Mysql and MongoDB, a kind of method of MongoDB attribute on-demand loading is provided, to greatest extent Reduce query latency, improve search efficiency and reduce MongoDB server load.Pass through Annotation technology identification MongoDB attribute has unified the mode of Mysql and MongoDB access data with a set of API.The attribute of MongoDB is proposed The mode of on-demand loading obtains data, reduces query latency while reducing MongoDB server stress.It should be noted that It is, although the embodiment provides the code for using CGLIB to be woven into on-demand loading, the present invention includes but not It is limited to this mode for being woven into code, any mode that can be woven into code all should be within the scope of the present invention.
The above method of each embodiment, equipment and/or device can be by there is the electronics of computing capability to set according to the present invention It is standby to execute the software comprising computer instruction to realize.The electronic equipment for having computing capability can be general processor, number Word signal processor, application specific processor, re-configurable processor etc., but not limited to this.Such instruction is executed so that electronics Equipment is configured as executing above-mentioned operations according to the present invention.Above-mentioned each equipment and/or component can be set in an electronics Standby middle realization, can also realize in distinct electronic apparatuses.These softwares may be stored in a computer readable storage medium.Meter Calculation machine readable storage medium storing program for executing stores one or more programs (software module), and one or more of programs include instruction, works as electricity When one or more processors in sub- equipment execute described instruction, described instruction makes electronic equipment execute side of the invention Method.
These softwares can store the form for volatile memory or non-volatile memory device (such as similar to ROM etc. Store equipment), it is whether erasable or rewritable, or it is stored as form (such as the RAM, storage core of memory Piece, equipment or integrated circuit), or be stored on light readable medium or magnetic readable medium (for example, CD, DVD, disk or magnetic Band etc.).It should be appreciated that storage equipment and storage medium are adapted for storing the machine readable storage dress of one or more programs The embodiment set, one program or multiple programs include instruction, when executed, realize implementation of the invention Example.Embodiment provides program and stores the machine-readable storage device of this program, and described program includes for realizing the present invention Any one claim described in device or method code.Furthermore, it is possible to via any medium (for example, via wired Connection is wirelessly connected the signal of communication carried) it sends a telegram here and transmits these programs, multiple embodiments uitably include these programs.
The method of each embodiment, equipment and/or device can also use such as field programmable gate array according to the present invention (FPGA), programmable logic array (PLA), system on chip, the system on substrate, the system in encapsulation, specific integrated circuit (ASIC) or can be realized for carrying out the hardware such as any other rational method that is integrated or encapsulating or firmware to circuit, Or it is realized with software, the appropriately combined of hardware and firmware three kinds of implementations.It is used when realizing in such ways Software, hardware and/or firmware be programmed or be designed as to execute the corresponding above method, step and/or function according to the present invention. Those skilled in the art can come according to actual needs suitably by one or more of these systems and module, or in which A part or multiple portions are realized using different above-mentioned implementations.These implementations each fall within protection model of the invention It encloses.
Although the present invention, art technology has shown and described referring to certain exemplary embodiments of the invention Personnel it should be understood that in the case where the spirit and scope of the present invention limited without departing substantially from the following claims and their equivalents, A variety of changes in form and details can be carried out to the present invention.Therefore, the scope of the present invention should not necessarily be limited by above-described embodiment, But should be not only determined by appended claims, also it is defined by the equivalent of appended claims.

Claims (16)

1. a kind of database storage method, comprising:
The Mysql attribute value in Java object is stored to Mysql according to iBatis configuration file corresponding with Java object Database, and obtain Mysql major key ID of the Java object in Mysql database;
Whether determine has the MongoDB attribute value that store MongoDB database in Java object;
If there is no the MongoDB attribute value that store MongoDB database in Java object, terminate this storage;With And
If there is the MongoDB attribute value that store MongoDB database in Java object, storing MongoDB The MongoDB attribute value of database is stored in MongoDB database together with the Mysql major key ID of the Java object, terminates this Secondary storage;
Wherein, the affiliated MongoDB attribute of MongoDB attribute value is corresponding with the agent object as query result object, the generation Reason object includes Mysql attribute value and on-demand loading code, the on-demand loading code when called, according to what is be queried The Mysql major key ID of Java object inquires MongoDB attribute value from MongoDB database to return to MongoDB attribute value.
2. database storage method according to claim 1, wherein determine Java according to Java Annotation technology Whether there is the attribute value that store in MongoDB database in object and determines the attribute value.
3. a kind of data base query method, comprising:
The Mysql attribute value in Mysql database is inquired according to iBatis configuration file corresponding with the Java entity of inquiry;
It determines in Java entity and whether contains MongoDB attribute;
If not containing MongoDB attribute in Java entity, query result pair is returned to based on the Mysql attribute value inquired As;And
If containing MongoDB attribute in Java entity, on-demand loading generation corresponding with the MongoDB attribute is generated Code, and Mysql attribute value and on-demand loading code are assembled into agent object, and return to the agent object as query result Object, wherein the on-demand loading code when called, according to the Mysql major key ID for the Java object being queried from MongoDB attribute value is inquired in MongoDB database to return to MongoDB attribute value.
4. data base query method according to claim 3, wherein;
Determine in Java entity whether contain MongoDB attribute using Java Annotation technology;And/or
The on-demand loading code is generated using CGLIB technology.
5. a kind of method from query result object acquisition attribute value according to claim 3 or 4, comprising:
Whether the determination attribute value to be obtained corresponds to MongoDB attribute;
If the attribute value to be obtained does not correspond to MongoDB attribute, the attribute value is returned;And
If the attribute value to be obtained corresponds to MongoDB attribute, arrived according to major key ID of the query result object in Mysql The attribute value is inquired in MongoDB database and returns to the attribute value.
6. according to the method described in claim 5, wherein:
If the attribute value to be obtained corresponds to MongoDB attribute, judge whether the attribute value is sky, if the attribute value is Sky then inquires the attribute value in major key ID to the MongoDB database according to query result object in Mysql and returns to the category Property value, otherwise directly returns to the attribute value.
7. according to the method described in claim 5, further include: the MongoDB attribute value inquired is assigned to accordingly MongoDB attribute.
8. a kind of database storage device, comprising:
For the Mysql attribute value storage in Java object to be arrived according to iBatis configuration file corresponding with Java object Mysql database, and obtain the device of Mysql major key ID of the Java object in Mysql database;
For determining the device for whether having the attribute value that store MongoDB database in Java object;
If terminating the device of this storage for not having to store the attribute value of MongoDB database in Java object; And
If for there is the attribute value that store MongoDB database in Java object, storing MongoDB data The attribute value in library is stored in MongoDB database together with the Mysql major key ID of the Java object, terminates the dress of this storage It sets;
Wherein, the affiliated MongoDB attribute of MongoDB attribute value is to the agent object that should be used as query result object, the agency Object includes Mysql attribute value and on-demand loading code, the on-demand loading code when called, according to the Java being queried The Mysql major key ID of object inquires MongoDB attribute value from MongoDB database to return to MongoDB attribute value.
9. database storage device according to claim 8, wherein determine Java according to Java Annotation technology Whether there is the attribute value that store in MongoDB database in object and determines the attribute value.
10. a kind of database inquiry facility, comprising:
Mysql for being inquired in Mysql database according to iBatis configuration file corresponding with the Java entity of inquiry belongs to The device of property value;
For determine in Java entity whether the device containing MongoDB attribute;
If returning to query result based on the Mysql attribute value inquired for not containing MongoDB attribute in Java entity The device of object;And
If generating on-demand loading corresponding with the MongoDB attribute for containing MongoDB attribute in Java entity The device of code, and Mysql attribute value and on-demand loading code are assembled into agent object, and return to the agent object conduct Query result object, wherein the on-demand loading code when called, according to the Mysql major key for the Java object being queried ID inquires MongoDB attribute value from MongoDB database to return to MongoDB attribute value.
11. database inquiry facility according to claim 10, wherein;
Determine in Java entity whether contain MongoDB attribute using Java Annotation technology;And/or
The on-demand loading code is generated using CGLIB technology.
12. a kind of equipment from query result object acquisition attribute value described according to claim 10 or 11, comprising:
Whether correspond to the device of MongoDB attribute for the determination attribute value to be obtained;
If not corresponding to MongoDB attribute for the attribute value to be obtained, the device of the attribute value is returned;And
If corresponding to MongoDB attribute for the attribute value to be obtained, according to major key of the query result object in Mysql The attribute value is inquired in ID to MongoDB database and returns to the device of the attribute value.
13. equipment according to claim 12, in which:
If the attribute value to be obtained corresponds to MongoDB attribute, judge whether the attribute value is sky, if the attribute value is Sky then inquires the attribute value in major key ID to the MongoDB database according to query result object in Mysql and returns to the category Property value, otherwise directly returns to the attribute value.
14. equipment according to claim 12, further includes: the MongoDB attribute value for will inquire is assigned to accordingly MongoDB attribute device.
15. a kind of computer system, comprising:
One or more processors;
Storage device, for storing executable instruction, the executable instruction is realized when being executed by the processor according to power Benefit require any one of 1~7 described in method.
16. a kind of computer readable storage medium, is stored thereon with executable instruction, which realizes root when being executed by processor According to method according to any one of claims 1 to 7.
CN201610035963.4A 2016-01-20 2016-01-20 Database purchase and querying method, attribute value-acquiring method and equipment Active CN105718556B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610035963.4A CN105718556B (en) 2016-01-20 2016-01-20 Database purchase and querying method, attribute value-acquiring method and equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610035963.4A CN105718556B (en) 2016-01-20 2016-01-20 Database purchase and querying method, attribute value-acquiring method and equipment

Publications (2)

Publication Number Publication Date
CN105718556A CN105718556A (en) 2016-06-29
CN105718556B true CN105718556B (en) 2019-06-04

Family

ID=56147267

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610035963.4A Active CN105718556B (en) 2016-01-20 2016-01-20 Database purchase and querying method, attribute value-acquiring method and equipment

Country Status (1)

Country Link
CN (1) CN105718556B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109725982B (en) * 2017-10-31 2020-12-11 迈普通信技术股份有限公司 Data object construction method and device
CN114637761B (en) * 2022-03-10 2024-03-19 马上消费金融股份有限公司 Business object generation method and device

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101067820A (en) * 2007-06-08 2007-11-07 北京大学 Method for prefetching object
CN103051684A (en) * 2012-12-07 2013-04-17 百度在线网络技术(北京)有限公司 Method, system and device for converting website into Web App for displaying
CN103778239A (en) * 2014-01-28 2014-05-07 北京京东尚科信息技术有限公司 Multi-database data management method and system

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8965915B2 (en) * 2013-03-17 2015-02-24 Alation, Inc. Assisted query formation, validation, and result previewing in a database having a complex schema

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101067820A (en) * 2007-06-08 2007-11-07 北京大学 Method for prefetching object
CN103051684A (en) * 2012-12-07 2013-04-17 百度在线网络技术(北京)有限公司 Method, system and device for converting website into Web App for displaying
CN103778239A (en) * 2014-01-28 2014-05-07 北京京东尚科信息技术有限公司 Multi-database data management method and system

Also Published As

Publication number Publication date
CN105718556A (en) 2016-06-29

Similar Documents

Publication Publication Date Title
CN104537069B (en) A kind of document configuration and application system and its method
CN102799640B (en) Page charger and page loading method
CN106598591A (en) Webpage dynamic menu generation method and device
CN111142971B (en) Cloud platform application ready checking method suitable for traditional application clouding
CN111179086B (en) Intelligent contract virtual machine based on WebAsssemly
CN104156313A (en) Method for automatically generating Web service testing case
EP3945436A1 (en) Methods, apparatuses, and devices for generating digital document of title
CN104423982B (en) The processing method and processing equipment of request
CN103778239B (en) Multi-database data management method and system
CN103905231A (en) Method and device for unified management of device types
CN105573774B (en) Application Parameters management and configuration method
CN105718556B (en) Database purchase and querying method, attribute value-acquiring method and equipment
CN104408073A (en) Data operation method and device
CN101639777A (en) Plug and play method of member, application and system thereof
CN114327481A (en) Code processing method, device, equipment and storage medium
CN104462605B (en) A kind of configuration of data base persistence layer frame, amending method and system
CN112860802A (en) Database operation statement processing method and device and electronic equipment
CN110609703B (en) Performance detection tool implementation method and device, readable storage medium and terminal equipment
US10095494B2 (en) Systems and methods for footprint based scheduling
US7716646B2 (en) Loading a chain of processors from an XML file
CN109324838A (en) Execution method, executive device and the terminal of SCM program
CN109947476B (en) Statistical method and system for runtime stack space
CN111680478B (en) Report generation method, device, equipment and storage medium based on configuration software
CN107239484A (en) Database operation method, device and computer equipment
CN102473090A (en) A plurality of interface files usable for access to BIOS

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant