CN113515564A - Data access method, device, equipment and storage medium based on J2EE - Google Patents

Data access method, device, equipment and storage medium based on J2EE Download PDF

Info

Publication number
CN113515564A
CN113515564A CN202110538037.XA CN202110538037A CN113515564A CN 113515564 A CN113515564 A CN 113515564A CN 202110538037 A CN202110538037 A CN 202110538037A CN 113515564 A CN113515564 A CN 113515564A
Authority
CN
China
Prior art keywords
target
data access
database
data
interface
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.)
Pending
Application number
CN202110538037.XA
Other languages
Chinese (zh)
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 Saiante Technology Service Co Ltd
Original Assignee
Ping An International Smart City 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 Ping An International Smart City Technology Co Ltd filed Critical Ping An International Smart City Technology Co Ltd
Priority to CN202110538037.XA priority Critical patent/CN113515564A/en
Publication of CN113515564A publication Critical patent/CN113515564A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • 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/25Integrating or interfacing systems involving database management systems
    • G06F16/252Integrating or interfacing systems involving database management systems between a Database Management System and a front-end application
    • 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/24Querying
    • G06F16/242Query formulation
    • G06F16/2433Query languages
    • 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/25Integrating or interfacing systems involving database management systems
    • G06F16/258Data format conversion from or to a database
    • 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
    • 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)
  • Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Mathematical Physics (AREA)
  • Computational Linguistics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention relates to the field of big data, and discloses a data access method, a device, equipment and a storage medium based on J2EE, which are used for improving the efficiency of data access. The data access method based on J2EE comprises the following steps: receiving a data access request sent by a terminal, and determining a target data access interface according to the data access request; performing data source matching on the target data access interface to obtain a target database corresponding to the target data access interface; according to the target database, creating target metadata information corresponding to the target database; calling a preset code generator, and generating a target data access class corresponding to the target metadata information according to the target metadata information and the target database; and converting the target data access class into a data query statement, acquiring target data according to the data query statement, and transmitting the target data to the terminal.

Description

Data access method, device, equipment and storage medium based on J2EE
Technical Field
The invention relates to the field of big data, in particular to a data access method, a data access device, data access equipment and a storage medium based on J2 EE.
Background
The data storage is the core of various application programs, the J2EE architecture is the mainstream architecture of the current data storage, the J2EE provides a series of methods for storing and extracting data, and certainly, data access is also necessary, and due to the diversity of data sources, a unified data access framework is imperative. J2EE provides a set of simple and efficient APIs for accessing, modifying and deleting data for data "consumers", and can access various heterogeneous data sources in a uniform manner and provide a uniform interface for application data access.
However, in the prior art, the data access framework has many layers, and cannot access data in a uniform and simple manner, thereby reducing the efficiency of data access.
Disclosure of Invention
The invention mainly aims to solve the technical problem of low data access efficiency at present.
The invention provides a data access method based on J2EE in a first aspect, and the data access method based on J2EE comprises the following steps: receiving a data access request sent by a terminal, and determining a target data access interface according to the data access request; performing data source matching on the target data access interface to obtain a target database corresponding to the target data access interface; according to the target database, creating target metadata information corresponding to the target database; calling a preset code generator, and generating a target data access class corresponding to the target metadata information according to the target metadata information and the target database; and converting the target data access class into a data query statement, acquiring target data according to the data query statement, and transmitting the target data to the terminal.
Optionally, in a first implementation manner of the first aspect of the present invention, the receiving a data access request sent by a terminal, and determining a target data access interface according to the data access request includes: receiving a data access request sent by a terminal; analyzing the data access request to obtain interface information corresponding to the data access request, wherein the interface information comprises an interface type; and inquiring a target data access interface corresponding to the data access request according to the interface type.
Optionally, in a second implementation manner of the first aspect of the present invention, the performing data source matching on the target data access interface to obtain a target database corresponding to the target data access interface includes: acquiring a mapping relation between the target data access interface and a preset data source, wherein the data source comprises a relational database, a Nosql database and an ElasticSearch database; and matching a target database corresponding to the target data access interface according to the mapping relation.
Optionally, in a third implementation manner of the first aspect of the present invention, the creating, according to the target database, target metadata information corresponding to the target database includes: when the target database is a relational database, creating a database table, wherein the database table comprises a library name, a schema name, a table field name and a table field attribute; when the target database is a Nosql database, creating a list table, wherein the list table comprises a key-value key value, an expiration time, a document structure and a list table structure; when the target database is an ElasticSearch database, creating field information, wherein the field information comprises an index name, an index mapping field structure relation and a field type; and determining the database table, the list and the field information as target metadata information.
Optionally, in a fourth implementation manner of the first aspect of the present invention, the invoking a preset code generator, and generating a target data access class corresponding to the target metadata information according to the target metadata information and the target database includes: when the target database is the relational database, acquiring a configuration file through a preset code generator and mapping the target metadata information into a first entity class, wherein the target metadata information is the database table; when the target database is the Nosql database, mapping the target metadata information into a map class through the code generator, wherein the target metadata information is the list table; when the target database is the ElasticSearch database, mapping the target metadata information into a second entity class through the code generator, wherein the target metadata information is the field information; determining the first entity class, the map class and the second entity class as a target data access class.
Optionally, in a fifth implementation manner of the first aspect of the present invention, the converting the target data access class into a data query statement, acquiring target data according to the data query statement, and transmitting the target data to the terminal includes: converting the target data access class into a plurality of SQL query statements, and splicing the plurality of SQL query statements to obtain data query statements; performing data query in a data source based on the data query statement to obtain target data; and performing json format conversion on the target data, and transmitting the converted json format target data to the terminal.
Optionally, in a sixth implementation manner of the first aspect of the present invention, after the converting the target data access class into a data query statement, acquiring target data according to the data query statement, and transmitting the target data to the terminal, the method further includes: and calling a preset visual interface to perform data display on the target data, and performing version migration on the target data.
The second aspect of the present invention provides a J2 EE-based data access device, wherein the J2 EE-based data access device comprises: the receiving module is used for receiving a data access request sent by a terminal and determining a target data access interface according to the data access request; the matching module is used for carrying out data source matching on the target data access interface to obtain a target database corresponding to the target data access interface; the creating module is used for creating target metadata information corresponding to the target database according to the target database; the generation module is used for calling a preset code generator and generating a target data access class corresponding to the target metadata information according to the target metadata information and the target database; and the data acquisition module is used for converting the target data access class into a data query statement, acquiring target data according to the data query statement and transmitting the target data to the terminal.
Optionally, in a first implementation manner of the second aspect of the present invention, the receiving module is specifically configured to: receiving a data access request sent by a terminal; analyzing the data access request to obtain interface information corresponding to the data access request, wherein the interface information comprises an interface type; and inquiring a target data access interface corresponding to the data access request according to the interface type.
Optionally, in a second implementation manner of the second aspect of the present invention, the matching module is specifically configured to: acquiring a mapping relation between the target data access interface and a preset data source, wherein the data source comprises a relational database, a Nosql database and an ElasticSearch database; and matching a target database corresponding to the target data access interface according to the mapping relation.
Optionally, in a third implementation manner of the second aspect of the present invention, the creating module is specifically configured to: when the target database is a relational database, creating a database table, wherein the database table comprises a library name, a schema name, a table field name and a table field attribute; when the target database is a Nosql database, creating a list table, wherein the list table comprises a key-value key value, an expiration time, a document structure and a list table structure; when the target database is an ElasticSearch database, creating field information, wherein the field information comprises an index name, an index mapping field structure relation and a field type; and determining the database table, the list and the field information as target metadata information.
Optionally, in a fourth implementation manner of the second aspect of the present invention, the generating module is specifically configured to: when the target database is the relational database, acquiring a configuration file through a preset code generator and mapping the target metadata information into a first entity class, wherein the target metadata information is the database table; when the target database is the Nosql database, mapping the target metadata information into a map class through the code generator, wherein the target metadata information is the list table; when the target database is the ElasticSearch database, mapping the target metadata information into a second entity class through the code generator, wherein the target metadata information is the field information; determining the first entity class, the map class and the second entity class as a target data access class.
Optionally, in a fifth implementation manner of the second aspect of the present invention, the data obtaining module is specifically configured to: converting the target data access class into a plurality of SQL query statements, and splicing the plurality of SQL query statements to obtain data query statements; performing data query in a data source based on the data query statement to obtain target data; and performing json format conversion on the target data, and transmitting the converted json format target data to the terminal.
Optionally, in a sixth implementation manner of the second aspect of the present invention, the J2 EE-based data access apparatus further includes: and the visualization module is used for calling a preset visualization interface to perform data display on the target data and performing version migration on the target data.
The third aspect of the present invention provides a data access device based on J2EE, including: a memory and at least one processor, the memory having instructions stored therein; the at least one processor invokes the instructions in the memory to cause the J2 EE-based data access device to perform the J2 EE-based data access method described above.
A fourth aspect of the present invention provides a computer-readable storage medium having stored therein instructions, which when run on a computer, cause the computer to execute the above-described J2 EE-based data access method.
In the technical scheme provided by the invention, a data access request sent by a terminal is received, and a target data access interface is determined according to the data access request; performing data source matching on the target data access interface to obtain a target database corresponding to the target data access interface; according to the target database, creating target metadata information corresponding to the target database; calling a preset code generator, and generating a target data access class corresponding to the target metadata information according to the target metadata information and the target database; and converting the target data access class into a data query statement, acquiring target data according to the data query statement, and transmitting the target data to the terminal. The invention improves the efficiency of data access.
Drawings
FIG. 1 is a schematic diagram of an embodiment of a data access method based on J2EE in the embodiment of the present invention;
FIG. 2 is a schematic diagram of another embodiment of a data access method based on J2EE in the embodiment of the present invention;
FIG. 3 is a schematic diagram of an embodiment of a data access device based on J2EE in an embodiment of the present invention;
FIG. 4 is a schematic diagram of another embodiment of a data access device based on J2EE in the embodiment of the present invention;
fig. 5 is a schematic diagram of an embodiment of a data access device based on J2EE in the embodiment of the present invention.
Detailed Description
The embodiment of the invention provides a data access method, a data access device, data access equipment and a storage medium based on J2 EE. The terms "first," "second," "third," "fourth," and the like in the description and in the claims, as well as in the drawings, if any, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It will be appreciated that the data so used may be interchanged under appropriate circumstances such that the embodiments described herein may be practiced otherwise than as specifically illustrated or described herein. Furthermore, the terms "comprises," "comprising," or "having," and any variations thereof, are intended to cover non-exclusive inclusions, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
For convenience of understanding, a specific flow of the embodiment of the present invention is described below, and referring to fig. 1, an embodiment of the data access method based on J2EE in the embodiment of the present invention includes:
101. receiving a data access request sent by a terminal, and determining a target data access interface according to the data access request;
it is to be understood that the execution subject of the present invention may be a data access device based on J2EE, and may also be a terminal or a server, which is not limited herein. The embodiment of the present invention is described by taking a server as an execution subject.
The method includes that a server receives a data access request sent by a terminal, for example, if the server receives a data access request which is sent by a certain terminal and carries a terminal type of the terminal, the server analyzes the data access request based on the terminal type and the data access request to obtain interface information corresponding to the data access request, and finally, a preset data access interface is queried according to the interface information to obtain a corresponding target data access interface, where the target data access interface is, for example: the target data access interface comprises a public interface and a private interface, the public interface and the private interface are both interfaces which are set according to a preset area, and the data access interface in the preset area is inquired according to interface information to obtain the target data access interface.
It should be noted that the terminal of this embodiment may include an apple system ios terminal and an Android system Android terminal, but is not limited thereto. The terminal and the server may be connected through various wireless communication methods, and the present invention is not limited herein.
102. Performing data source matching on the target data access interface to obtain a target database corresponding to the target data access interface;
the server carries out data source matching on the target data access interface to obtain a target database corresponding to the target data access interface, wherein the data source comprises: relational databases, non-relational databases (Not Only sql, Nosql) and distributed databases (ES).
103. According to the target database, target metadata information corresponding to the target database is created;
the server obtains a database type of a target database, wherein the database type is one of a relational type, Nosql and elastic search, and then creates target metadata information of the corresponding target database according to the database type. The server defines metadata of the target database aiming at the database type, such as: if the database type of the target database is a relational database, defining table structure information; if the database type of the target database is Nosql, defining a key name and key value data structure; if the database type of the target database is an ElasticSearch database, an index field structure is defined.
104. Calling a preset code generator, and generating a target data access class corresponding to the target metadata information according to the target metadata information and a target database;
the server perfects the target metadata information, and then generates a corresponding target data access class according to the target metadata information, and the target data access classes generated for different database types are different, for example: if the database type is a relational type, mapping the database table (namely target metadata information) into an entity class (namely a target data access class); if the database type is the Nosql database, defining the key name (namely the target metadata information) as a map class (namely a target data access class); if the database type is an ElasticSearch database, the index field (i.e., the target metadata information) is mapped to an entity class (i.e., the target data access class).
105. And converting the target data access class into a data query statement, acquiring target data according to the data query statement, and transmitting the target data to the terminal.
The server converts the target data access class into a data query statement, queries in a target database through the data query statement to obtain target data, converts the target data into json format data, and transmits the json format data to the terminal.
In the embodiment of the invention, a data access request sent by a terminal is received, and a target data access interface is determined according to the data access request; performing data source matching on the target data access interface to obtain a target database corresponding to the target data access interface; according to the target database, target metadata information corresponding to the target database is created; calling a preset code generator, and generating a target data access class corresponding to the target metadata information according to the target metadata information and a target database; and converting the target data access class into a data query statement, acquiring target data according to the data query statement, and transmitting the target data to the terminal. The invention integrates the data of different database types and different data structures during data access by unifying the data access interfaces, thereby improving the efficiency of data access.
Referring to fig. 2, another embodiment of the data access method based on J2EE in the embodiment of the present invention includes:
201. receiving a data access request sent by a terminal, and determining a target data access interface according to the data access request;
the server receives a data access request sent by a terminal, for example, if the server receives a data access request which is sent by a certain terminal and carries a terminal type of the terminal, the server analyzes the data access request based on the terminal type and the data access request to obtain interface information corresponding to the data access request. And finally, inquiring the preset data access interface according to the interface information to obtain a corresponding target data access interface, for example: the target data access interface comprises a public interface and a private interface, the public interface and the private interface are both interfaces which are set according to a preset area, and the data access interface in the preset area is inquired according to interface information to obtain the target data access interface.
It should be noted that the terminal of this embodiment may include an apple system ios terminal and an Android system Android terminal, but is not limited thereto. The terminal and the server may be connected through various wireless communication methods, and the present invention is not limited herein.
Optionally, step 201 includes: receiving a data access request sent by a terminal; analyzing the data access request to obtain interface information corresponding to the data access request, wherein the interface information comprises an interface type; and inquiring a target data access interface corresponding to the data access request according to the interface type.
The server receives a data access request sent by a terminal, analyzes interface information of the data access request to obtain interface information, inquires a target data access interface corresponding to the data access request according to the interface information, wherein the interface type comprises a public interface or a private interface, the public interface refers to an interface which can be shared by all terminals, the private interface refers to an exclusive interface of a certain type of terminal, the public interface is arranged in one storage area, and the private interface of each type of client (namely, the terminal) is arranged in the other storage area so as to be used for inquiring the target data access interface corresponding to the data access request.
202. Performing data source matching on the target data access interface to obtain a target database corresponding to the target data access interface;
the server carries out data source matching on the target data access interface to obtain a target database corresponding to the target data access interface, wherein the data source comprises: relational databases, non-relational databases (Not Only sql, Nosql) and distributed databases (ES).
Optionally, step 202 includes: acquiring a mapping relation between a target data access interface and a preset data source, wherein the data source comprises a relational database, a Nosql database and an ElasticSearch database; and matching the target database corresponding to the target data access interface according to the mapping relation.
Specifically, the server configures a corresponding relation between a data access interface and a data source in advance, and stores the corresponding relation in a configuration file, wherein the data source comprises a relational database, a Nosql database and an elastic search database, the relational database is a database which organizes data by adopting a relational model, the relational database stores data in the form of rows and columns, the rows and columns for storing the data are called as tables, and a group of tables form the database; the Nosql database has the advantages of easy expansion, large data volume and high performance, and the Nosql database has very high read-write performance; the ElasticSearch database is a distributed, high-expansion and high-real-time searching and data analyzing engine, can search, analyze and explore a large amount of data, and is matched with a preset data source by a server through a target data access interface and a corresponding relation to obtain a target database.
203. According to the target database, target metadata information corresponding to the target database is created;
the server obtains a database type of a target database, wherein the database type is one of a relational type, Nosql and elastic search, and then creates target metadata information of the corresponding target database according to the database type. The server defines metadata of the target database aiming at the database type, such as: if the database type of the target database is a relational database, defining table structure information (namely metadata) of the target database; if the database type of the target database is Nosql, defining the target database based on the key name and the key value data structure (namely metadata); if the database type of the target database is an ElasticSearch database, the target database is defined by an index field structure (i.e. metadata).
Optionally, step 203 includes: when the target database is a relational database, creating a database table, wherein the database table comprises a library name, a schema name, a table field name and a table field attribute; when the target database is a Nosql database, creating a list table, wherein the list table comprises a key-value key value, an expiration time, a document structure and a list table structure; when the target database is an ElasticSearch database, creating field information, wherein the field information comprises an index name, an index mapping field structure relation and a field type; and determining the database table, the list and the field information as target metadata information.
When the data source is a relational database, the server creates a database table (namely target metadata information) comprising a library name, a schema name, a table field name and a table field attribute; when the data source is the Nosql database, the created list (i.e., target metadata information) includes: key-value key and expiration time, document structure, and list structure; when the data source is an ElasticSearch database, the created field information (i.e., target metadata information) includes: index name, index map field structure and field type, and the server stores the target metadata information by establishing a metadata information base of the target metadata information.
204. Calling a preset code generator, and generating a target data access class corresponding to the metadata information according to the target metadata information and a target database;
the server perfects the target metadata information, and then generates a corresponding target data access class according to the target metadata information, and the target data access classes generated for different database types are different, for example: if the database type is a relational type, mapping the database table into a first entity class (namely a target data access class); if the database type is the Nosql database, defining a map class (namely a target data access class) of the key name; if the database type is an ElasticSearch database, the index field is mapped to a second entity class (i.e., a target data access class).
Optionally, step 204 includes: when the target database is the relational database, acquiring a configuration file through a preset code generator and mapping the target metadata information into a first entity class, wherein the target metadata information is the database table; when the target database is the Nosql database, mapping the target metadata information into a map class through the code generator, wherein the target metadata information is the list table; when the target database is the ElasticSearch database, mapping the target metadata information into a second entity class through the code generator, wherein the target metadata information is the field information; determining the first entity class, the map class and the second entity class as a target data access class.
The server generates an entity java class (namely target metadata information) according to a preset code generator and a database table, wherein the preset code generator can be an open source framework mybatis of java, the database table can be a processing relational database table, further, the server automatically creates the database table and can automatically generate the entity java class mapped by the table and create an sql file by using a groovy script, and the specific steps are as follows: and perfecting metadata information, and generating a related entity class according to the metadata information: if the target database is a relational database, mapping the database table into a first entity class; if the target database is the Nosql database, defining a key name as a map class; and if the target database is an ElasticSearch database, mapping the index name, the index mapping field structure relationship and the field type into a second entity class.
205. Converting the target data access class into a plurality of SQL query statements, and splicing the plurality of SQL query statements to obtain data query statements;
and the server converts the target data access class into a data query statement, converts the target data access class into a plurality of SQL query statements, and splices the plurality of SQL query statements to obtain the data query statement.
206. Performing data query in a data source based on the data query statement to obtain target data;
the server acquires target data in the data source according to the data query statement, and determines whether to execute database query operation according to a preset query option configuration item when the data query result is null, namely: and obtaining cache configuration parameters, if the query option configuration items in the cache configuration parameters are that the query cache is not found, querying the database, calling a database cache strategy class to execute database query operation, and finally taking the result of executing the database query operation as target data.
207. And performing json format conversion on the target data, and transmitting the converted json format target data to the terminal.
Specifically, the server performs json format conversion on the target data, the objects are enclosed by brackets during format conversion, each json value is represented by a key value pair, the keys and the values are separated by colons and the keys are required to be of a character string type, the json values are separated by commas, the arrays are enclosed by square brackets, the class examples are converted into the json objects, the json character strings are returned to obtain the target data after the format conversion, and the target data after the format conversion is transmitted to the data access request terminal through a preset data channel.
Optionally, after step 207, the method further includes: and calling a preset visual interface to perform data display on the target data, and performing version migration on the target data.
The user can carry out data display to the target data through the visual interface, and the server carries out parameter setting to the visual interface, obtains the show interface, and the show interface is for example: web page theme style, pie chart and line chart, etc.
The server carries out version updating on the target data, carries out version change control management on the target data, adds metadata information of a new version on the basis of keeping the version of the original target data version information when the target data version information is changed each time, adds 0.1 to the version number, and checks the target data information of a historical version through a visual interface to realize automatic migration of data.
The server carries out version migration on target data, firstly, the version information when metadata information is created for the first time is recorded through a system version table, the initial version number is v1.0, the effective version number of a current system is v1.0, and meanwhile, a full amount of SQL script files are provided and comprise data manipulation statements (DML) and data definition statements (DDL); the Nosql database and the ElasticSearch database provide a full json format file, the filename suffixes of the SQL script file and the json file both have version numbers and are used for automatically executing upgrading operation later, the relational database triggers a table structure to generate a change event by creating a database trigger function, an incremental DDL statement SQL script file is generated according to the table change event, the generated SQL script file name suffix is the changed version number, and the Nosql database and the ElasticSearch database are modified through a web interface to provide an incremental json format file. In addition, the server records the details of each change of the target data, the changed incremental script file and the currently effective version number, when the system is started, a detection change task is triggered, whether the currently effective version number of the system version table is consistent with the version number of the provided incremental script file or not is compared, if the currently effective version number of the system is a historical version, version migration is triggered, and automatic version migration of the target data is realized by executing the incremental script.
With reference to fig. 3, the data access method based on J2EE in the embodiment of the present invention is described above, and a data access device based on J2EE in the embodiment of the present invention is described below, where an embodiment of the data access device based on J2EE in the embodiment of the present invention includes:
a receiving module 301, configured to receive a data access request sent by a terminal, and determine a target data access interface according to the data access request;
a matching module 302, configured to perform data source matching on the target data access interface to obtain a target database corresponding to the target data access interface;
a creating module 303, configured to create, according to the target database, target metadata information corresponding to the target database;
a generating module 304, configured to invoke a preset code generator, and generate a target data access class corresponding to the target metadata information according to the target metadata information and the target database;
a data obtaining module 305, configured to convert the target data access class into a data query statement, obtain target data according to the data query statement, and transmit the target data to the terminal.
In the embodiment of the invention, a data access request sent by a terminal is received, and a target data access interface is determined according to the data access request; performing data source matching on the target data access interface to obtain a target database corresponding to the target data access interface; according to the target database, creating target metadata information corresponding to the target database; calling a preset code generator, and generating a target data access class corresponding to the target metadata information according to the target metadata information and the target database; and converting the target data access class into a data query statement, acquiring target data according to the data query statement, and transmitting the target data to the terminal. The invention improves the efficiency of data access.
Referring to fig. 4, another embodiment of the data access apparatus based on J2EE according to the embodiment of the present invention includes:
a receiving module 301, configured to receive a data access request sent by a terminal, and determine a target data access interface according to the data access request;
a matching module 302, configured to perform data source matching on the target data access interface to obtain a target database corresponding to the target data access interface;
a creating module 303, configured to create, according to the target database, target metadata information corresponding to the target database;
a generating module 304, configured to invoke a preset code generator, and generate a target data access class corresponding to the target metadata information according to the target metadata information and the target database;
a data obtaining module 305, configured to convert the target data access class into a data query statement, obtain target data according to the data query statement, and transmit the target data to the terminal.
And the visualization module 306 is configured to invoke a preset visualization interface to perform data display on the target data, and perform version migration on the target data.
Optionally, the receiving module 301 is specifically configured to: receiving a data access request sent by a terminal; analyzing the data access request to obtain interface information corresponding to the data access request, wherein the interface information comprises an interface type; and inquiring a target data access interface corresponding to the data access request according to the interface type.
Optionally, the matching module 302 is specifically configured to: acquiring a mapping relation between the target data access interface and a preset data source, wherein the data source comprises a relational database, a Nosql database and an ElasticSearch database; and matching a target database corresponding to the target data access interface according to the mapping relation.
Optionally, the creating module 303 is specifically configured to: when the target database is a relational database, creating a database table, wherein the database table comprises a library name, a schema name, a table field name and a table field attribute; when the target database is a Nosql database, creating a list table, wherein the list table comprises a key-value key value, an expiration time, a document structure and a list table structure; when the target database is an ElasticSearch database, creating field information, wherein the field information comprises an index name, an index mapping field structure relation and a field type; and determining the database table, the list and the field information as target metadata information.
Optionally, the generating module 304 is specifically configured to: when the target database is the relational database, acquiring a configuration file through a preset code generator and mapping the target metadata information into a first entity class, wherein the target metadata information is the database table; when the target database is the Nosql database, mapping the target metadata information into a map class through the code generator, wherein the target metadata information is the list table; when the target database is the ElasticSearch database, mapping the target metadata information into a second entity class through the code generator, wherein the target metadata information is the field information; determining the first entity class, the map class and the second entity class as a target data access class.
Optionally, the data obtaining 305 module is specifically configured to: converting the target data access class into a plurality of SQL query statements, and splicing the plurality of SQL query statements to obtain data query statements; performing data query in a data source based on the data query statement to obtain target data; and performing json format conversion on the target data, and transmitting the converted json format target data to the terminal.
Fig. 3 and 4 above describe the data access device based on J2EE in the embodiment of the present invention in detail from the perspective of modular functional entities, and the data access device based on J2EE in the embodiment of the present invention is described in detail from the perspective of hardware processing.
Fig. 5 is a schematic structural diagram of a J2 EE-based data access device, where the J2 EE-based data access device 500 may have a relatively large difference due to different configurations or performances, and may include one or more processors (CPUs) 510 (e.g., one or more processors) and a memory 520, and one or more storage media 530 (e.g., one or more mass storage devices) for storing applications 533 or data 532. Memory 520 and storage media 530 may be, among other things, transient or persistent storage. The program stored on the storage medium 530 may include one or more modules (not shown), each of which may include a sequence of instructions operating on the J2 EE-based data access device 500. Still further, the processor 510 may be configured to communicate with the storage medium 530 to execute a series of instruction operations in the storage medium 530 on the J2 EE-based data access device 500.
The J2 EE-based data access device 500 may also include one or more power supplies 540, one or more wired or wireless network interfaces 550, one or more input-output interfaces 560, and/or one or more operating systems 531, such as Windows server, Mac OS X, Unix, Linux, FreeBSD, and the like. Those skilled in the art will appreciate that the J2 EE-based data access device architecture shown in FIG. 5 does not constitute a limitation of the J2 EE-based data access device and may include more or fewer components than shown, or some components in combination, or a different arrangement of components.
The invention also provides a data access device based on J2EE, wherein the data access device based on J2EE comprises a memory and a processor, and computer readable instructions are stored in the memory, and when being executed by the processor, the computer readable instructions cause the processor to execute the steps of the data access method based on J2EE in the embodiments.
The present invention also provides a computer readable storage medium, which may be a non-volatile computer readable storage medium, which may also be a volatile computer readable storage medium, having stored therein instructions, which, when run on a computer, cause the computer to perform the steps of the J2 EE-based data access method.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a read-only memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present invention, and not for limiting the same; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (10)

1. A data access method based on J2EE, wherein the data access method based on J2EE comprises:
receiving a data access request sent by a terminal, and determining a target data access interface according to the data access request;
performing data source matching on the target data access interface to obtain a target database corresponding to the target data access interface;
according to the target database, creating target metadata information corresponding to the target database;
calling a preset code generator, and generating a target data access class corresponding to the target metadata information according to the target metadata information and the target database;
and converting the target data access class into a data query statement, acquiring target data according to the data query statement, and transmitting the target data to the terminal.
2. The J2 EE-based data access method according to claim 1, wherein the receiving a data access request from a terminal and determining a target data access interface according to the data access request comprises:
receiving a data access request sent by a terminal;
analyzing the data access request to obtain interface information corresponding to the data access request, wherein the interface information comprises an interface type;
and inquiring a target data access interface corresponding to the data access request according to the interface type.
3. The J2 EE-based data access method according to claim 1, wherein the performing data source matching on the target data access interface to obtain the target database corresponding to the target data access interface comprises:
acquiring a mapping relation between the target data access interface and a preset data source, wherein the data source comprises a relational database, a Nosql database and an ElasticSearch database;
and matching a target database corresponding to the target data access interface according to the mapping relation.
4. The J2 EE-based data access method according to claim 3, wherein the creating target metadata information corresponding to the target database according to the target database comprises:
when the target database is a relational database, creating a database table, wherein the database table comprises a library name, a schema name, a table field name and a table field attribute;
when the target database is a Nosql database, creating a list table, wherein the list table comprises a key-value key value, an expiration time, a document structure and a list table structure;
when the target database is an ElasticSearch database, creating field information, wherein the field information comprises an index name, an index mapping field structure relation and a field type;
and determining the database table, the list and the field information as target metadata information.
5. The J2 EE-based data access method according to claim 4, wherein the invoking a preset code generator and generating a target data access class corresponding to the target metadata information according to the target metadata information and the target database comprises:
when the target database is the relational database, acquiring a configuration file through a preset code generator and mapping the target metadata information into a first entity class, wherein the target metadata information is the database table;
when the target database is the Nosql database, mapping the target metadata information into a map class through the code generator, wherein the target metadata information is the list table;
when the target database is the ElasticSearch database, mapping the target metadata information into a second entity class through the code generator, wherein the target metadata information is the field information;
determining the first entity class, the map class and the second entity class as a target data access class.
6. The J2 EE-based data access method according to claim 1, wherein the converting the target data access class into a data query statement and obtaining target data according to the data query statement, and the transmitting the target data to the terminal comprises:
converting the target data access class into a plurality of SQL query statements, and splicing the plurality of SQL query statements to obtain data query statements;
performing data query in a data source based on the data query statement to obtain target data;
and performing json format conversion on the target data, and transmitting the converted json format target data to the terminal.
7. The J2 EE-based data access method according to any one of claims 1-6, wherein after the converting the target data access class into a data query statement, acquiring target data according to the data query statement, and transmitting the target data to the terminal, further comprising:
and calling a preset visual interface to perform data display on the target data, and performing version migration on the target data.
8. A J2 EE-based data access device, the J2 EE-based data access device comprising:
the receiving module is used for receiving a data access request sent by a terminal and determining a target data access interface according to the data access request;
the matching module is used for carrying out data source matching on the target data access interface to obtain a target database corresponding to the target data access interface;
the creating module is used for creating target metadata information corresponding to the target database according to the target database;
the generation module is used for calling a preset code generator and generating a target data access class corresponding to the target metadata information according to the target metadata information and the target database;
and the data acquisition module is used for converting the target data access class into a data query statement, acquiring target data according to the data query statement and transmitting the target data to the terminal.
9. A J2 EE-based data access device, the J2 EE-based data access device comprising: a memory and at least one processor, the memory having instructions stored therein;
the at least one processor invoking the instructions in the memory to cause the J2EE based data access device to perform the J2EE based data access method of any one of claims 1-7.
10. A computer readable storage medium having instructions stored thereon, wherein the instructions, when executed by a processor, implement the J2 EE-based data access method of any one of claims 1-7.
CN202110538037.XA 2021-05-18 2021-05-18 Data access method, device, equipment and storage medium based on J2EE Pending CN113515564A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110538037.XA CN113515564A (en) 2021-05-18 2021-05-18 Data access method, device, equipment and storage medium based on J2EE

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110538037.XA CN113515564A (en) 2021-05-18 2021-05-18 Data access method, device, equipment and storage medium based on J2EE

Publications (1)

Publication Number Publication Date
CN113515564A true CN113515564A (en) 2021-10-19

Family

ID=78064416

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110538037.XA Pending CN113515564A (en) 2021-05-18 2021-05-18 Data access method, device, equipment and storage medium based on J2EE

Country Status (1)

Country Link
CN (1) CN113515564A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114090760A (en) * 2022-01-20 2022-02-25 阿里巴巴达摩院(杭州)科技有限公司 Data processing method of table question and answer, electronic equipment and readable storage medium
CN116226153A (en) * 2023-05-05 2023-06-06 中国工商银行股份有限公司 Data updating method and device, processor and electronic equipment

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090112835A1 (en) * 2007-10-24 2009-04-30 Marvin Elder Natural language database querying
CN104866513A (en) * 2014-02-26 2015-08-26 国际商业机器公司 System and method for cross-tenant data access
US20160314157A1 (en) * 2013-12-19 2016-10-27 Tencent Technology (Shenzhen) Company Limited Method, server, and system for accessing metadata
CN111400765A (en) * 2020-03-25 2020-07-10 支付宝(杭州)信息技术有限公司 Private data access method and device and electronic equipment
CN111752959A (en) * 2020-05-29 2020-10-09 南京南瑞继保电气有限公司 Real-time database cross-database SQL interaction method and system
CN111782719A (en) * 2020-08-20 2020-10-16 支付宝(杭州)信息技术有限公司 Data processing method and device
CN111782682A (en) * 2020-06-30 2020-10-16 北京金山云网络技术有限公司 Data query method, device, equipment and storage medium
CN111782653A (en) * 2020-06-30 2020-10-16 平安国际智慧城市科技股份有限公司 Data query method and device, electronic equipment and storage medium
CN111858760A (en) * 2020-07-13 2020-10-30 中国工商银行股份有限公司 Data processing method and device for heterogeneous database
CN111949693A (en) * 2020-08-12 2020-11-17 北京锐安科技有限公司 Data processing device, data processing method, storage medium and electronic equipment

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090112835A1 (en) * 2007-10-24 2009-04-30 Marvin Elder Natural language database querying
US20160314157A1 (en) * 2013-12-19 2016-10-27 Tencent Technology (Shenzhen) Company Limited Method, server, and system for accessing metadata
CN104866513A (en) * 2014-02-26 2015-08-26 国际商业机器公司 System and method for cross-tenant data access
CN111400765A (en) * 2020-03-25 2020-07-10 支付宝(杭州)信息技术有限公司 Private data access method and device and electronic equipment
CN111752959A (en) * 2020-05-29 2020-10-09 南京南瑞继保电气有限公司 Real-time database cross-database SQL interaction method and system
CN111782682A (en) * 2020-06-30 2020-10-16 北京金山云网络技术有限公司 Data query method, device, equipment and storage medium
CN111782653A (en) * 2020-06-30 2020-10-16 平安国际智慧城市科技股份有限公司 Data query method and device, electronic equipment and storage medium
CN111858760A (en) * 2020-07-13 2020-10-30 中国工商银行股份有限公司 Data processing method and device for heterogeneous database
CN111949693A (en) * 2020-08-12 2020-11-17 北京锐安科技有限公司 Data processing device, data processing method, storage medium and electronic equipment
CN111782719A (en) * 2020-08-20 2020-10-16 支付宝(杭州)信息技术有限公司 Data processing method and device

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
GUO YONG等: "Research and application on metadata integration for data warehouses", PROCEEDINGS 2013 INTERNATIONAL CONFERENCE ON MECHATRONIC SCIENCES, ELECTRIC ENGINEERING AND COMPUTER (MEC), 28 August 2014 (2014-08-28), pages 1640 - 1644 *
皮莹莹: "处理海量数据的异构数据库访问中间件的设计与实现", 中国优秀硕士学位论文全文数据库 (信息科技辑), vol. 2013, no. 6, 15 June 2013 (2013-06-15), pages 138 - 872 *
赵华等: "农业科技大数据仓储建设与服务", 数字图书馆论坛, vol. 2020, no. 8, 25 August 2020 (2020-08-25), pages 48 - 55 *

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114090760A (en) * 2022-01-20 2022-02-25 阿里巴巴达摩院(杭州)科技有限公司 Data processing method of table question and answer, electronic equipment and readable storage medium
CN116226153A (en) * 2023-05-05 2023-06-06 中国工商银行股份有限公司 Data updating method and device, processor and electronic equipment
CN116226153B (en) * 2023-05-05 2023-08-11 中国工商银行股份有限公司 Data updating method and device, processor and electronic equipment

Similar Documents

Publication Publication Date Title
CN109299102B (en) HBase secondary index system and method based on Elastcissearch
CN110032604B (en) Data storage device, translation device and database access method
CN110795455B (en) Dependency analysis method, electronic device, computer apparatus, and readable storage medium
US11354284B2 (en) System and method for migration of a legacy datastore
US10579634B2 (en) Apparatus and method for operating a distributed database with foreign tables
US10565208B2 (en) Analyzing multiple data streams as a single data object
US7676474B2 (en) Systems and methods for finding log files generated by a distributed computer
CN111767303A (en) Data query method and device, server and readable storage medium
CN111324610A (en) Data synchronization method and device
JP2010524060A (en) Data merging in distributed computing
WO2020238597A1 (en) Hadoop-based data updating method, device, system and medium
CN109710220B (en) Relational database query method, relational database query device, relational database query equipment and storage medium
JP2017535842A (en) Simplify calling the import procedure to transfer data from the data source to the data target
CN113515564A (en) Data access method, device, equipment and storage medium based on J2EE
CN102999600A (en) Method and system for automatically generating embedded database
CN113901078A (en) Business order association query method, device, equipment and storage medium
WO2017096155A1 (en) Methods and systems for mapping object oriented/functional languages to database languages
US11567957B2 (en) Incremental addition of data to partitions in database tables
CN112131214A (en) Method, system, equipment and storage medium for data writing and data query
CN112417225A (en) Joint query method and system for multi-source heterogeneous data
US11681721B2 (en) Systems and methods for spark lineage data capture
US11544170B2 (en) Tool for interrogating heterogeneous computing systems
US10558637B2 (en) Modularized data distribution plan generation
CN112732704B (en) Data processing method, device and storage medium
US20240232176A9 (en) Automated creation of optimized persistent database views

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
TA01 Transfer of patent application right

Effective date of registration: 20211025

Address after: Room 201, building a, No.1 Qianwan 1st Road, Shenzhen Hong Kong cooperation zone, Shenzhen, Guangdong Province (settled in Shenzhen Qianhai business secretary Co., Ltd.)

Applicant after: Shenzhen saiante Technology Service Co.,Ltd.

Address before: 1-34 / F, Qianhai free trade building, 3048 Xinghai Avenue, Mawan, Qianhai Shenzhen Hong Kong cooperation zone, Shenzhen, Guangdong 518000

Applicant before: Ping An International Smart City Technology Co.,Ltd.

TA01 Transfer of patent application right