CN108334620A - A kind of method and device operating Cluster Database based on ORM frames - Google Patents
A kind of method and device operating Cluster Database based on ORM frames Download PDFInfo
- Publication number
- CN108334620A CN108334620A CN201810126890.9A CN201810126890A CN108334620A CN 108334620 A CN108334620 A CN 108334620A CN 201810126890 A CN201810126890 A CN 201810126890A CN 108334620 A CN108334620 A CN 108334620A
- Authority
- CN
- China
- Prior art keywords
- database
- data
- sql statement
- fragment
- orm
- 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/242—Query formulation
- G06F16/2433—Query languages
-
- 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/22—Indexing; Data structures therefor; Storage structures
- G06F16/2282—Tablespace storage structures; Management thereof
Abstract
A kind of method and device operating Cluster Database based on ORM frames, the method includes the steps:Obtain the metadata information of current entity operation object;Physical operation is converted into SQL statement;SQL statement is parsed, based on parsing acquisition of information database fragment;Based on database fragment, data source is obtained;Obtain the database connection pool of database fragment;Based on database connection pool, obtains database connection and execute SQL statement;Result data is converted into entity object.The method and device that Cluster Database is operated based on ORM frames of the present invention, being capable of providing one supports point library to divide the database lightweight access technique frame of table and read and write abruption, and can also solve the problems, such as that existing ORM technological frames do not support Cluster Database access rule, routing, load and high availability etc..
Description
Technical field
The present invention relates to technical field of data processing, and Cluster Database is operated based on ORM frames more particularly to a kind of
Method and device.
Background technology
With the development of internet, enterprise is more and more for the demand of data-base cluster, but original system is mostly using pass
It is type database.For existing operation system, it is switched to big data platform, the cost that user's study and business are changed is equal
It is higher.
The ORM such as the fields JAVA more commonly used Hibernate, Spring JDBC, iBatis at present(Object
Relational Mapping)Technology cannot all support the application of data-base cluster well.
Invention content
In order to solve the shortcomings of the prior art, the purpose of the present invention is to provide one kind being based on ORM frame operation sets
The method and device of group database solves existing database ORM technological frames and does not support asking for point table point library and read and write abruption
Topic.
To achieve the above object, the method provided by the invention that Cluster Database is operated based on ORM frames, including following step
Suddenly:
Obtain the metadata information of current entity operation object;
Physical operation is converted into SQL statement;
SQL statement is parsed, based on parsing acquisition of information database fragment;
Based on database fragment, data source is obtained;
Obtain the database connection pool of database fragment;
Based on database connection pool, obtains database connection and execute SQL statement;
Result data is converted into entity object.
The step of parsing SQL statement, further comprises step:Parse correlation table and field information in SQL statement.
It is described be based on database fragment, obtain data source the step of further comprise step:Judge the database obtained point
It is multiple whether piece has, and if only obtaining general data source there are one if, if having multiple and being to need issued transaction, obtains distribution
Transaction Information source.
The step of database connection pool for obtaining database fragment, further comprises step:Carry out load balancing and mistake
Detection is lost, the optimal data library connection pool of current database fragment is obtained.
The step of acquisition database connection and execution SQL statement, further comprises step:If there is multiple databases
Fragment, then concurrently execute data connection, and level calculation processing carries out Data Integration processing after the return of all results.
To achieve the above object, the device provided by the invention that Cluster Database is operated based on ORM frames, including:First number
According to management module, regular routing module, data source management module and data processing module, wherein
The metadata management module, the metadata information for obtaining current entity operation object;And result data is turned
It is changed to entity object;
The rule routing module, for physical operation to be converted to SQL statement;And parsing SQL statement, based on parsing information
Obtain database fragment;
The data source management module obtains data source for being based on database fragment;And obtain the data of database fragment
Library connection pool;
The data processing module, for being based on database connection pool, obtaining database connection and executing SQL statement.
The rule routing module, is further used for parsing correlation table and field information in SQL statement.
It is multiple to be further used for judging whether the database fragment obtained has for the data source management module, if only one
It is a, general data source is obtained, if having multiple and being to need issued transaction, obtains distributed transaction data source.
The data source management module is further used for carrying out load balancing and failure detection, obtains current database point
The optimal data library connection pool of piece.
The data processing module concurrently executes data connection if being further used for having multiple database fragments, horizontal
Calculation processing carries out Data Integration processing after the return of all results.
The method and device that Cluster Database is operated based on ORM frames of the present invention is capable of providing one and supports point library point
The database lightweight access technique frame of table and read and write abruption, and existing ORM technological frames can also be solved and do not supported
The problem of Cluster Database access rule, routing, load and high availability etc..
Other features and advantages of the present invention will be illustrated in the following description, also, partly becomes from specification
It obtains it is clear that understand through the implementation of the invention.
Description of the drawings
Attached drawing is used to provide further understanding of the present invention, and a part for constitution instruction, and with the present invention's
Embodiment together, for explaining the present invention, is not construed as limiting the invention.In the accompanying drawings:
Fig. 1 is the method flow diagram that Cluster Database is operated based on ORM frames according to the present invention;
Fig. 2 is that figure is shown in detail according to a kind of content for the configuration file of the present invention defined into line discipline;
Fig. 3 is that figure is shown in detail according to a kind of content of data source profile of the present invention;
Fig. 4 is the device architecture figure that Cluster Database is operated based on ORM frames according to the present invention.
Specific implementation mode
Hereinafter, preferred embodiments of the present invention will be described with reference to the accompanying drawings, it should be understood that preferred reality described herein
Apply example only for the purpose of illustrating and explaining the present invention and is not intended to limit the present invention.
Fig. 1 is the method flow diagram that Cluster Database is operated based on ORM frames according to the present invention, below with reference to Fig. 1,
The method for operating Cluster Database based on ORM frames of the present invention is described in detail.
In step 110, the metadata information of current entity operation object is obtained.
In the step, when needing to carry out data increasing to company-data base resource, delete, change, look into etc. physical operations, pass through member
Data management module obtains current entity operation object(Such as JPA entity class)Metadata information.
In step 120, physical operation is converted into SQL statement.
In the step, JDBC will be converted to the physical operation of entity object(Equal interfaces)Executable SQL statement.
In step 130, SQL statement is parsed, based on parsing acquisition of information database fragment.
In the step, pass through SQLJEP(Equal class libraries)Correlation table and field information in SQL statement are parsed, then passes through regular road
By module, all qualified database fragment titles are obtained.
Wherein it is possible to be defined in advance into line discipline to database, table etc., such as vertically divide library or by number by business progress
According to progress horizontal segmentation.Fig. 2 is a kind of configuration file defined into line discipline according to the present invention(rule.xml)Content it is detailed
Diagram.
In step 140, it is based on database fragment, obtains data source.
Specifically, judge obtain database fragment whether have it is multiple, if only there are one if obtain general data source, if
Have multiple and be to need issued transaction, then obtains distributed transaction data source.
In step 150, the database connection pool of database fragment is obtained.
In the step, pass through data source management module(It supports data source health detection, read and write abruption, load balancing and moves
State load configuration)Load balancing and failure detection are carried out, the optimal data library connection pool of current database fragment is obtained.Fig. 3 is
A kind of data source profile according to the present invention(DataSource.config)Content figure is shown in detail.
In the present embodiment, data source management module supports database loads balanced and failure detection, can improve cluster number
According to the high availability in library.
In step 160, it is based on database connection pool, obtain database connection and executes SQL statement.
In the step, database connection is obtained by database connection pool, if there are multiple database fragments, number can be passed through
Data connection is concurrently executed according to processing module, level calculation processing carries out Data Integration processing after the return of all results, holding
While row SQL statement, data access speed is promoted.
In the present embodiment, multiple data source level calculations are realized, as a result merging treatment, repeatedly asked relative to data mapping
It asks, there is obvious raising in performance.
In step 170, result data is converted into entity object.
In the step, by metadata management module, the data that database is returned(Execute the result that SQL statement obtains
Data)Be converted to entity object return.
Fig. 4 is the device architecture figure that Cluster Database is operated based on ORM frames according to the present invention, as shown in figure 4, this hair
The bright device that Cluster Database is operated based on ORM frames, including:Metadata management module, regular routing module, data source capsule
Manage module and data processing module, wherein
Metadata management module, the metadata information for obtaining current entity operation object;And result data is converted to
Entity object.
Specifically, when needing to carry out data increasing to company-data base resource, delete, change, look into etc. physical operations, pass through member
Data management module obtains current entity operation object(Such as JPA entity class)Metadata information.
The data that metadata management module can also return to database(The result data of physical operation)Be converted to entity
Object returns.
Regular routing module, for physical operation to be converted to SQL statement;And parsing SQL statement, based on parsing information
Obtain database fragment.
Specifically, by JDBC is converted to the physical operation of entity object(Equal interfaces)Executable SQL statement;And
Pass through SQLJEP(Equal class libraries)Correlation table and field information in SQL statement are parsed, then by regular routing module, obtains all symbols
The database fragment title of conjunction condition.
Wherein it is possible to be defined in advance into line discipline to database, table etc., such as vertically divide library or by number by business progress
According to progress horizontal segmentation.
Data source management module obtains data source for being based on database fragment;And obtain the data of database fragment
Library connection pool.
Specifically, judge obtain database fragment whether have it is multiple, if only there are one if obtain general data source, if
Have multiple and be to need issued transaction, then obtains distributed transaction data source.
And pass through data source management module(Support data source health detection, read and write abruption, load balancing and dynamic load
Configuration)Load balancing and failure detection are carried out, the optimal data library connection pool of current database fragment is obtained.
In the present embodiment, data source management module supports database loads balanced and failure detection, can improve cluster number
According to the high availability in library.
Data processing module, for being based on database connection pool, obtaining database connection and executing SQL statement.
Specifically, obtaining database connection by database connection pool, if there are multiple database fragments, number can be passed through
Data connection is concurrently executed according to processing module, level calculation processing carries out Data Integration processing after the return of all results, holding
While row SQL statement, data access speed is promoted.
In the present embodiment, multiple data source level calculations are realized, as a result merging treatment, repeatedly asked relative to data mapping
It asks, there is obvious raising in performance.
The device based on ORM frames operation Cluster Database of the present invention can be a kind of computing device, and the calculating is set
It is standby including memory, processor and storage on a memory and the computer program that can run on a processor, the processor
The method that Cluster Database is operated based on ORM frames of the present invention is realized when executing described program.
The method and device that Cluster Database is operated based on ORM frames of the present invention is suitable for realizing based on JDBC technologies
Lightweight Cluster Database ORM technological frames, and compatible current JPA entity annotations class, need not use text is separately configured
Part, for the relatively low of enterprise upgrading Cluster Database application cost.
One of ordinary skill in the art will appreciate that:The foregoing is only a preferred embodiment of the present invention, and does not have to
In the limitation present invention, although the present invention is described in detail referring to the foregoing embodiments, for those skilled in the art
For, still can to foregoing embodiments record technical solution modify, or to which part technical characteristic into
Row equivalent replacement.All within the spirits and principles of the present invention, any modification, equivalent replacement, improvement and so on should all include
Within protection scope of the present invention.
Claims (10)
1. a kind of method operating Cluster Database based on ORM frames, which is characterized in that include the following steps:
Obtain the metadata information of current entity operation object;
Physical operation is converted into SQL statement;
SQL statement is parsed, based on parsing acquisition of information database fragment;
Based on database fragment, data source is obtained;
Obtain the database connection pool of database fragment;
Based on database connection pool, obtains database connection and execute SQL statement;
Result data is converted into entity object.
2. the method according to claim 1 for operating Cluster Database based on ORM frames, which is characterized in that the parsing
The step of SQL statement, further comprises step:
Parse correlation table and field information in SQL statement.
3. the method according to claim 1 for operating Cluster Database based on ORM frames, which is characterized in that described to be based on
The step of database fragment, acquisition data source, further comprises step:
It is multiple to judge whether the database fragment obtained has, if only obtaining general data source there are one if, if having multiple and being to need
Issued transaction is wanted, then obtains distributed transaction data source.
4. the method according to claim 1 for operating Cluster Database based on ORM frames, which is characterized in that the acquisition
The step of database connection pool of database fragment, further comprises step:
Load balancing and failure detection are carried out, the optimal data library connection pool of current database fragment is obtained.
5. the method according to claim 1 for operating Cluster Database based on ORM frames, which is characterized in that the acquisition
Database connects and further comprises step the step of executing SQL statement:
If there are multiple database fragments, data connection is concurrently executed, level calculation processing returns to laggard line number in all results
It is handled according to integration.
6. a kind of device operating Cluster Database based on ORM frames, which is characterized in that including:Metadata management module, rule
Routing module, data source management module and data processing module, wherein
The metadata management module, the metadata information for obtaining current entity operation object;And result data is turned
It is changed to entity object;
The rule routing module, for physical operation to be converted to SQL statement;And parsing SQL statement, based on parsing information
Obtain database fragment;
The data source management module obtains data source for being based on database fragment;And obtain the data of database fragment
Library connection pool;
The data processing module, for being based on database connection pool, obtaining database connection and executing SQL statement.
7. the device according to claim 6 for operating Cluster Database based on ORM frames, which is characterized in that the rule
Routing module is further used for parsing correlation table and field information in SQL statement.
8. the device according to claim 6 for operating Cluster Database based on ORM frames, which is characterized in that the data
It is multiple to be further used for judging whether the database fragment obtained has for source control module, if only obtaining general data there are one if
Source obtains distributed transaction data source if having multiple and being to need issued transaction.
9. the device according to claim 6 for operating Cluster Database based on ORM frames, which is characterized in that the data
Source control module is further used for carrying out load balancing and failure detection, and the optimal data library for obtaining current database fragment connects
Connect pond.
10. the device according to claim 6 for operating Cluster Database based on ORM frames, which is characterized in that the data
Processing module concurrently executes data connection, level calculation processing, all if being further used for having multiple database fragments
As a result Data Integration processing is carried out after returning.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810126890.9A CN108334620A (en) | 2018-02-08 | 2018-02-08 | A kind of method and device operating Cluster Database based on ORM frames |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810126890.9A CN108334620A (en) | 2018-02-08 | 2018-02-08 | A kind of method and device operating Cluster Database based on ORM frames |
Publications (1)
Publication Number | Publication Date |
---|---|
CN108334620A true CN108334620A (en) | 2018-07-27 |
Family
ID=62927251
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810126890.9A Withdrawn CN108334620A (en) | 2018-02-08 | 2018-02-08 | A kind of method and device operating Cluster Database based on ORM frames |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108334620A (en) |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110059102A (en) * | 2019-04-25 | 2019-07-26 | 四川师范大学 | The method for manipulating adaptation resolver based on isomorphism type distributed data base integration CRUD |
CN110209689A (en) * | 2019-05-09 | 2019-09-06 | 上海车轮互联网服务有限公司 | ORM data processing method and device based on Swoole |
CN113157726A (en) * | 2021-04-25 | 2021-07-23 | 中化石化销售有限公司 | Database processing method and device |
CN113641745A (en) * | 2021-08-18 | 2021-11-12 | 上海通联金融服务有限公司 | Method for operating database across language platforms |
CN113157726B (en) * | 2021-04-25 | 2024-05-03 | 中化石化销售有限公司 | Database processing method and device |
Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104391892A (en) * | 2014-11-11 | 2015-03-04 | 成都锐理开创信息技术有限公司 | Real estate information access system based on metadata driving |
-
2018
- 2018-02-08 CN CN201810126890.9A patent/CN108334620A/en not_active Withdrawn
Patent Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104391892A (en) * | 2014-11-11 | 2015-03-04 | 成都锐理开创信息技术有限公司 | Real estate information access system based on metadata driving |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110059102A (en) * | 2019-04-25 | 2019-07-26 | 四川师范大学 | The method for manipulating adaptation resolver based on isomorphism type distributed data base integration CRUD |
CN110209689A (en) * | 2019-05-09 | 2019-09-06 | 上海车轮互联网服务有限公司 | ORM data processing method and device based on Swoole |
CN113157726A (en) * | 2021-04-25 | 2021-07-23 | 中化石化销售有限公司 | Database processing method and device |
CN113157726B (en) * | 2021-04-25 | 2024-05-03 | 中化石化销售有限公司 | Database processing method and device |
CN113641745A (en) * | 2021-08-18 | 2021-11-12 | 上海通联金融服务有限公司 | Method for operating database across language platforms |
CN113641745B (en) * | 2021-08-18 | 2024-01-26 | 上海通联金融服务有限公司 | Method for operating database by cross-language platform |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110291517B (en) | Query language interoperability in graph databases | |
US10169601B2 (en) | System and method for reading and writing to big data storage formats | |
JP5298117B2 (en) | Data merging in distributed computing | |
US9280568B2 (en) | Zero downtime schema evolution | |
US7822710B1 (en) | System and method for data collection | |
US10528440B2 (en) | Metadata cataloging framework | |
US10909105B2 (en) | Logical logging for in-memory metadata store | |
US8682876B2 (en) | Techniques to perform in-database computational programming | |
US10339040B2 (en) | Core data services test double framework automation tool | |
US10956438B2 (en) | Catalog with location of variables for data | |
US11048683B2 (en) | Database configuration change management | |
US20170212930A1 (en) | Hybrid architecture for processing graph-based queries | |
US11243958B2 (en) | Implementing contract-based polymorphic and parallelizable SQL user-defined scalar and aggregate functions | |
US10725799B2 (en) | Big data pipeline management within spreadsheet applications | |
CN108334620A (en) | A kind of method and device operating Cluster Database based on ORM frames | |
US7970757B2 (en) | Computer program product for database query optimization | |
US8694525B2 (en) | Systems and methods for performing index joins using auto generative queries | |
Zou et al. | From a stream of relational queries to distributed stream processing | |
US11321314B2 (en) | Query content-based data generation | |
CN112286964A (en) | SQL statement optimization method, device, equipment and storage medium | |
US11281569B2 (en) | Self-curative computer process automates | |
US9201937B2 (en) | Rapid provisioning of information for business analytics | |
Reniers et al. | Schema design support for semi-structured data: Finding the sweet spot between NF and De-NF | |
CN115310127A (en) | Data desensitization method and device | |
CN113127496B (en) | Method and device for determining change data in database, medium and equipment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
WW01 | Invention patent application withdrawn after publication | ||
WW01 | Invention patent application withdrawn after publication |
Application publication date: 20180727 |