CN106886568A - One kind point table method, device and electronic equipment - Google Patents

One kind point table method, device and electronic equipment Download PDF

Info

Publication number
CN106886568A
CN106886568A CN201710023995.7A CN201710023995A CN106886568A CN 106886568 A CN106886568 A CN 106886568A CN 201710023995 A CN201710023995 A CN 201710023995A CN 106886568 A CN106886568 A CN 106886568A
Authority
CN
China
Prior art keywords
sublist
class
model
model class
data
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.)
Granted
Application number
CN201710023995.7A
Other languages
Chinese (zh)
Other versions
CN106886568B (en
CN106886568B8 (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.)
Zhangyue Technology Co Ltd
Original Assignee
Zhangyue 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 Zhangyue Technology Co Ltd filed Critical Zhangyue Technology Co Ltd
Priority to CN201710023995.7A priority Critical patent/CN106886568B8/en
Publication of CN106886568A publication Critical patent/CN106886568A/en
Publication of CN106886568B publication Critical patent/CN106886568B/en
Application granted granted Critical
Publication of CN106886568B8 publication Critical patent/CN106886568B8/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/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • G06F16/2358Change logging, detection, and notification
    • 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/22Indexing; Data structures therefor; Storage structures
    • G06F16/2282Tablespace storage structures; Management thereof

Abstract

The embodiment of the invention discloses one kind point table method, device and electronic installation, it is related to technical field of data processing.A point table method for the embodiment of the present invention includes:The multiple sublist model classes of dynamic generation, the sublist model class is registered in the configuration center of Open Framework, select to need to carry out the sublist model class of data manipulation in the sublist model class, and the data manipulation function provided using the Open Framework, need the example for carrying out the sublist model class of data manipulation to perform corresponding data manipulation to described.Additionally, the embodiment of the invention also discloses one kind point meter apparatus and electronic equipment.By the scheme of the embodiment of the present invention, the efficiency of point table can be effectively improved.

Description

One kind point table method, device and electronic equipment
Technical field
The present invention relates to technical field of data processing, more particularly to database point list processing technique.
Background technology
Hibernate is a persistence middleware increased income based on Java, to JDBC (Java Data Base Connectivity, Java database are connected) do the encapsulation of light weight.Its use ORM (Object Relation Mapping, Object Relation Mapping) mechanism, the mapping between Java object and relational database is realized, sql sentences are transmitted to database, and The result that database is returned is packaged into object.Enclosed inside JDBC accesses the operation of database, provides to upper layer application OODB Object Oriented Data Base accesses API.Because it can be with the formal operations data of object, as long as modification is matched somebody with somebody when changing database Value file, and without being concerned about database species, thus improve development efficiency.
Point table is by multiple tables that a big table cutting is same database that resistance factor data amount is excessive and influences performance A kind of method.Inventor realize it is of the invention during find, Hibernate-Shards Open Frameworks are to be based on The powerful point storehouse framework of Hibernate, but a point table is not supported.Hibernate NamingStrategy are Hibernate The table name replacement policy of offer, it can simply be divided table handling, but can not dynamically determine table name according to instance parameter, The general scene for being only used for temporally carrying out point table.Hibernate QueryInterceptor are that Hibernate is provided Inquiry blocker, user can be intercepted when sql sentences are generated, by corresponding table name dynamic replacement into specifically point table, Need to parse sql sentences, realize complexity, performance and maintainability are all poor, nor can dynamically be determined according to instance parameter Table name, typically can only user temporally carry out a point table.
Accordingly, it would be desirable to a kind of simpler effective point of list processing method based on Hibernate.
The content of the invention
In view of this, a kind of point of table method, device and electronic equipment, at least part of solution be the embodiment of the invention provides Problems of the prior art.
In a first aspect, a kind of point of table method is the embodiment of the invention provides, including:
The multiple sublist model classes of dynamic generation;
The sublist model class is registered in the configuration center of Open Framework;
Select to need to carry out the sublist model class of data manipulation in the sublist model class;
The data manipulation function provided using the Open Framework, to the sublist model class for needing to carry out data manipulation Example perform corresponding data manipulation.
A kind of specific implementation according to embodiments of the present invention, before the multiple sublist model classes of dynamic generation, Methods described also includes:
Single table model class defined in the Open Framework.
A kind of specific implementation according to embodiments of the present invention, the multiple sublist model classes of dynamic generation, including:
Obtain point table demand of the database of the Open Framework association;
Based on described point of table demand, being increased income using third party, class libraries is dynamic to generate multiple sublist model classes.
A kind of specific implementation according to embodiments of the present invention, the configuration center in Open Framework registers the son Table model class, including:
Generate the corresponding class file of the sublist model class;
The class file is stored in the default scan position of the Open Framework.
A kind of specific implementation according to embodiments of the present invention, the configuration center in Open Framework registers the son Table model class, including:
Obtain the session interface file of the Open Framework;
Based on the session interface file, judge whether the sublist model class is loaded using dynamical fashion;
When the sublist model class is loaded using dynamical fashion, the configuration file of the Open Framework is updated, and Re-create the session interface file of the Open Framework.
A kind of specific implementation according to embodiments of the present invention, needs into line number in the selection sublist model class According to the sublist model class of operation, including:
Point table requirement definition ashing technique of the database based on Open Framework association;
Obtain the preset field of the database of the Open Framework association;
Data operation is carried out to the preset field based on the ashing technique;
Result according to the data operation determines to need to carry out the sublist model class of data manipulation.
A kind of specific implementation according to embodiments of the present invention, the data manipulation provided using the Open Framework Function, needs the example for carrying out the sublist model class of data manipulation to perform corresponding data manipulation to described, including:
Data increase, data deletion, data modification and the data query function provided using the Open Framework, are explicitly referred to It is fixed described to need the sublist model class for carrying out data manipulation to carry out associated data operation.
A kind of specific implementation according to embodiments of the present invention, the data manipulation provided using the Open Framework Function, needs the example for carrying out the sublist model class of data manipulation to perform corresponding data manipulation to described, also includes:
The model instance for needing to carry out the sublist model class of data manipulation is built using method for reflection;
Data filling is carried out using model instance described in the class set pair not comprising repeat element.
Second aspect, the embodiment of the present invention additionally provides a kind of point of meter apparatus, including:
Generation module, for the multiple sublist model classes of dynamic generation;
Registering modules, the sublist model class is registered for the configuration center in Open Framework;
Selecting module, for selecting to need to carry out the sublist model class of data manipulation in the sublist model class;
Performing module, for the data manipulation function provided using the Open Framework, needs to carry out data behaviour to described The example of the sublist model class of work performs corresponding data manipulation.
A kind of specific implementation according to embodiments of the present invention, described device also includes:
Definition module, for single table model class defined in the Open Framework.
A kind of specific implementation according to embodiments of the present invention, the generation module is additionally operable to:
Obtain point table demand of the database of the Open Framework association;
Based on described point of table demand, being increased income using third party, class libraries is dynamic to generate multiple sublist model classes.
A kind of specific implementation according to embodiments of the present invention, the Registering modules are additionally operable to:
Generate the corresponding class file of the sublist model class;
The class file is stored in the default scan position of the Open Framework.
A kind of specific implementation according to embodiments of the present invention, the Registering modules are additionally operable to:
Obtain the session interface file of the Open Framework;
Based on the session interface file, judge whether the sublist model class is loaded using dynamical fashion;
When the sublist model class is loaded using dynamical fashion, the configuration file of the Open Framework is updated, and Re-create the session interface file of the Open Framework.
A kind of specific implementation according to embodiments of the present invention, the selecting module, including:
Definition module, point table requirement definition ashing technique of the database for being associated based on the Open Framework;
Acquisition module, the preset field of the database for obtaining the Open Framework association;
Computing module, for carrying out data operation to the preset field based on the ashing technique;
Determining module, for being determined to need to carry out the sublist model class of data manipulation according to the result of the data operation.
A kind of specific implementation according to embodiments of the present invention, the performing module, including:
Designated module, the data for being provided using the Open Framework are increased, data are deleted, data modification and data are looked into Function is ask, needs described in Explicit designation the sublist model class for carrying out data manipulation to carry out associated data operation.
A kind of specific implementation according to embodiments of the present invention, the performing module also includes:
Module is built, for building the model reality for needing to carry out the sublist model class of data manipulation using method for reflection Example;
Filling module, for carrying out data filling using model instance described in the class set pair not comprising repeat element.
The third aspect, the embodiment of the present invention additionally provides a kind of electronic equipment, and the electronic equipment includes:
At least one processor;And,
The memory being connected with least one processor communication;Wherein,
The memory storage has can be by the instruction of at least one computing device, and the instruction is by least one processor Perform so that at least one processor be able to carry out in any implementation of foregoing first aspect or first aspect point Table method.
Fourth aspect, the embodiment of the present invention additionally provides a kind of non-transient computer readable storage medium storing program for executing, the non-transient meter Calculation machine readable storage medium storing program for executing stores computer instruction, and the computer instruction is used to make the computer perform aforementioned first aspect or the Point table method in any implementation of one side.
5th aspect, the embodiment of the present invention additionally provides a kind of computer program product, and the computer program product includes The calculation procedure on non-transient computer readable storage medium storing program for executing is stored, the computer program includes programmed instruction, when the program When instruction is computer-executed, point table in making the computer perform any implementation of aforementioned first aspect or first aspect Method.
Provided in an embodiment of the present invention point of table method, device, electronic equipment, non-transient computer readable storage medium storing program for executing and meter Calculation machine program, by the multiple sublist model classes of dynamic generation and the data manipulation function of combination Hibernate, and then can be not Realize based on Hibernate frameworks to realize a point function of table ORM on the premise of significantly affecting performance and maintainability.Due to dividing Table name can dynamically be determined according to instance parameter during table, user only needs to formulate the rule that table name is dynamically determined according to instance parameter Then, thus reached the technology effect that implementation is simple, intelligibility strong and study cost and maintenance cost is greatly reduced Really, generally improve the efficiency of point table.
Brief description of the drawings
Technical scheme in order to illustrate more clearly the embodiments of the present invention, below will be attached to what is used needed for embodiment Figure is briefly described, it should be apparent that, drawings in the following description are only some embodiments of the present invention, for this area For those of ordinary skill, on the premise of not paying creative work, other accompanying drawings can also be obtained according to these accompanying drawings.
Fig. 1 is the schematic flow sheet of a kind of point of table method provided in an embodiment of the present invention;
Fig. 2 is the schematic flow sheet of another point of table method provided in an embodiment of the present invention;
Fig. 3 is a kind of stream of the dynamic load sublist model class provided in an embodiment of the present invention to Hibernate configuration center Journey schematic diagram;
Fig. 4 is that a kind of sublist model class based on hash provided in an embodiment of the present invention selects schematic flow sheet;
Fig. 5 is the flow that a kind of example to sub- table model class provided in an embodiment of the present invention performs corresponding data manipulation Schematic diagram;
Fig. 6 is the schematic block diagram of a kind of point of meter apparatus provided in an embodiment of the present invention;
Fig. 7 is the schematic block diagram of another point of meter apparatus provided in an embodiment of the present invention;
Fig. 8 is a kind of schematic block diagram of selecting module provided in an embodiment of the present invention;
Fig. 9 is a kind of schematic block diagram of performing module provided in an embodiment of the present invention;
Figure 10 is the structural representation of a kind of electronic equipment provided in an embodiment of the present invention.
Specific embodiment
The embodiment of the present invention is described in detail below in conjunction with the accompanying drawings.
It will be appreciated that described embodiment is only a part of embodiment of the invention, rather than whole embodiments.Base Embodiment in the present invention, those of ordinary skill in the art obtained under the premise of creative work is not made it is all its Its embodiment, belongs to the scope of protection of the invention.
Fig. 1 is a kind of point of table method provided in an embodiment of the present invention, and referring to Fig. 1, the method is comprised the following steps:
S101, the multiple sublist model classes of dynamic generation.
When in database data capacity development to a certain extent after, in order to improve database response speed, it is necessary to The single big table of whole database is split into multiple small tables.When being split, can be carried out using various preset rules, Such as:
(1) table is divided by natural time
Statistics amount such as a business reaches certain scale (such as 2,000,000 or so), then just Ke Yikaolv using The data of 1 year are used as a table storage, for example, table name is app, then the data of 2010 are exactly app_2010, app_ 2011 ....Other times mode can certainly be used, is such as divided to carry out according to the moon, such as app_2010_01, app_ 2010_02 ....
(2) by numeric type hash points of table
For example, if to store the information of user, and the amount of business datum is very big, is that can not meet storage with single table Demand, then just can carry out hash with the numbering of user, it can be common that operated with remainder, if to divide 30 tables to store The information of user, then Customs Assigned Number is 1 user 1%30=1, then be there is in user_01 tables, as the numbering of user is 500, then 500%30=20, by the information Store of this user in the table of user_20.
(3) table is divided by md5 values
Assuming that to store the file of user's upload, if upload amount is big, the bottleneck problem of system is also brought along, than Such as, if it exceeds if 20000 files, the browse efficiency of file can be reduced under a database table.Can now use The user name of file is carried out md5 or is made of the md5 check values of file, can be hash with first 3 of md5, so most We can be obtained by 16^3=4096 table, every time when storage file, it is possible to preceding the 3 of the md5 values of filename To determine this file, which table this deposits for position.
Each table of above-mentioned preset rules generation corresponds to a sub- table model class.Specifically, ByteBuddy can be used The multiple sublist model classes of dynamic generation, naturally it is also possible to increased income class libraries using other third parties such as cglib or javaassist, come The multiple sublist model classes of dynamic generation.These three class libraries are all to have used this class libraries of increasing income of asm, can be saved with dynamic operation Java Code constructs Dynamic Java class.
S102, the sublist model class is registered in the configuration center of Open Framework.
Being registered to hibernate configuration center can be loaded using static mode, it would however also be possible to employ dynamical fashion is loaded.
Hibernate is typically, according to relevant configuration information when web container starts, to scan class files, then It is registered in SessionFactory, Java section codes can be operated to construct Dynamic Java class, specifically by writes Java Assembly instruction serializing generation one class file, this class file is then loaded using classloader.
After the completion of starting in container, the class produced during normal program operation, because Hibernate can not know The class of other this new establishment, now can not directly use the interface of Hibernate.For this can by the way of dynamic registration come Carry out.In view of safety issue, the original SessionFactory for having existed is not used, but obtain SessionFactory, judges whether sublist model class is dynamically loaded into JVM, if it is, updating current Configuration, and re-create a SessionFactory.
S103, selects to need to carry out the sublist model class of data manipulation in the sublist model class.
Ashing technique is defined, corresponding sublist model class is selected according to specific hash parameter, the hash parameter can be Other fields of model major key Id, or model, can also be time parameter etc..
For example, such as recording the database of all purchaser records of user, if all records put into In one table userbuy table, will certainly be very huge.So a point list processing can be carried out by user id, by different user Purchaser record be put into different points of tables.Specific practice is as follows:
Portfolio is estimated, by initial userbuy tables, 100 userbuy_index tables of identical table structure is expanded to, Former table structure is as follows:
The userbuy list data structure of table one
Field Type Null Key value Acquiescence
id bigint(20)unsigned NO PRI NULL
uid int(10)unsigned NO 0
goods varchar(128) NO
num int(10)unsigned NO 0
ctime int(10)unsigned NO 0
All of point of table uses identical table structure, and when newly-increased point of token record is needed, process is as follows:First Hash calculating is carried out to user id, hash values are obtained, the hash values necessarily 0-99, it is therefore an objective to by corresponding user id data, It is written in same point table, now, sublist model class just can be chosen based on the hash values.
S104, the data manipulation function provided using the Open Framework, to the sublist for needing to carry out data manipulation The example of model class performs corresponding data manipulation.
Use the data manipulation work(such as primary Hibernate data increase, data deletion, data modification and data query Can, the specific sublist model class of Explicit designation carries out associated data operation.A point table is specified by display, user can clearly specify It is which point table to initiate associated data operation to, user can clearly understand the physical data structure of data.
Specifically, by the example of constructor table model class, and example to the sublist model class carries out data manipulation To realize data manipulation function.During the example of tectonic model class, corresponding sublist model class is first selected according to hash parameter, then The model instance of correspondence subclass is constructed using method for reflection Class.newInstance (), the filling of set methods is finally reused Object.
During point table is realized, in addition to the step S101~S104 in above-described embodiment, optionally, referring to figure 2, this point of table method can also comprise the following steps:
S201, single table model class defined in the Open Framework.
Specifically, following code can be added in the configuration file hibernate.cfg.xml of Hibernate:
< properties >
< property name=" hibernate.hbm2ddl.auto " value=" create "/>
</properties >
By single table model class, the multiple sublist models that can be dynamically generated in step S101 defined in Open Framework During class, the single table model category code defined in de-multiplexing steps S201 while simplified code is write, is more convenient for carrying out code Safeguard.
Point table method in the present embodiment, realizes simply, using simple, there is very strong intelligibility, is greatly reduced Cost and maintenance cost are practised, performance is close to the primary mono- table handlings of ORM.
Optionally, the embodiment of the present invention additionally provides a kind of dynamic load sublist model class to Hibernate configuration center Method, referring to Fig. 3, the method comprises the following steps:
S301, obtains the session interface file of the Open Framework.
, it is necessary to obtain SessionFactory interfaces for Hibernate, specifically, can pass through Configuation examples create SessionFactory, as follows:
Configuration config=new Configuration () .configure ();
SessionFactory sessionFactory=config.buildSessionFactory ();
Configuration examples config can construct SessionFactory examples simultaneously according to current configuration information Return.
S302, based on the session interface file, judges whether the sublist model class is loaded using dynamical fashion.
Specifically, a Map can be obtained by the getAllClassMetadata methods of SessionFactory, The key of Map is the title of entity class, and whether value is ClassMetadata objects, by judging contain in map.keySet () There is the mode of the sublist model class to judge whether the sublist model class is loaded using dynamical fashion.Such as:
S303, when the sublist model class is loaded using dynamical fashion, updates the configuration text of the Open Framework Part, and re-create the session interface file of the Open Framework.
Specifically, Hibernate can be updated by setting function configuration.addAnnotatedClass () Configuration file, and re-create Hibernate's by setting function sessionFactoryList.add () SessionFactory。
Through the above way, the configuration center of sublist model class to Hibernate can be loaded by dynamical fashion.
Referring to Fig. 4, the embodiment of the present invention additionally provides a kind of sublist model class system of selection based on hash, including as follows Step:
S401, point table requirement definition ashing technique of the database based on Open Framework association.
According to specifically point table demand, ashing technique is defined, by taking the database table single structure shown in table one as an example, number It is divided into 100 sublists according to the table in storehouse, at this point it is possible to select to carry out hash calculating using crc32 modes.
S402, obtains the preset field of the database of the Open Framework association.
Specifically, can take the either field in table one carries out hash calculating, such as can select id as default Field.
S403, data operation is carried out based on the ashing technique to the preset field.
Crc32 result of calculations are a 10 system numbers, and under different bit operating system, the value for obtaining may not Together, so carrying out a unified treatment to it, remainder calculating is then carried out to this natural number, the divisor of remainder is exactly a point table Number, such as be 100 here.
S404, the result according to the data operation determines to need to carry out the sublist model class of data manipulation.
By calculating the preset field of database, a table suffix number index within 0-99 is thus obtained, led to Cross and index numerical value is associated with sublist model class, you can it is determined that needing to carry out the sublist model class of data manipulation.
By the method in above-described embodiment, single table can be more evenly distributed in each sublist.
Referring to Fig. 5, the embodiment of the present invention additionally provides a kind of example to sub- table model class and performs corresponding data manipulation Method, comprise the following steps:
S501, the data increase provided using the Open Framework, data deletion, data modification and data query function, The sublist model class for carrying out data manipulation is needed described in Explicit designation carries out associated data operation.
Use the data manipulation work(such as primary Hibernate data increase, data deletion, data modification and data query Can, the specific sublist model class of Explicit designation carries out associated data operation.A point table is specified by display, user can clearly specify It is which point table to initiate associated data operation to, user can clearly understand the physical data structure of data.
By taking the deletion action of sublist model class as an example, can be carried out using following code:
Tx=session.beginTransaction ();
User=(UserEntity) session.get (UserEntity.shardFor (" 2 "), " 2 ");
System.out.println(user.getName());
session.delete(user);
tx.commit();
S502, the model instance for needing to carry out the sublist model class of data manipulation is built using method for reflection.
Specifically, first selecting corresponding sublist model class according to hash parameter, method for reflection is reused The model instance of Class.newInstance () construction correspondence subclasses.
S503, data filling is carried out using model instance described in the class set pair not comprising repeat element.
Specifically, can be using data filling be carried out to the model instance using set methods, such as:
UserEntityuser=(UserEntity) session.get (UserEntity.shardFor (" 2 "), " 2″);
user.setName(″user_modified″)
By the method in the present embodiment, the sublist mould for needing to carry out data manipulation can be specified by explicit way Type class carries out associated data operation.
Fig. 6 is a kind of point of meter apparatus provided in an embodiment of the present invention, and referring to Fig. 6, the device includes:
Generation module 601, for the multiple sublist model classes of dynamic generation.
After the data capacity development to a certain extent in database, in order to improve the response speed of database, can be with The single big table of whole database is split into multiple small tables.When being split, can be carried out using various preset rules, Such as:
(1) table is divided by natural time
Statistics amount such as a business reaches certain scale (such as 2,000,000 or so), then just Ke Yikaolv using The data of 1 year are used as a table storage, for example, table name is app, then the data of 2010 are exactly app_2010, app_ 2011 ....Other times mode can certainly be used, is such as divided to carry out according to the moon, such as app_2010_01, app_ 2010_02 ....
(2) by numeric type hash points of table
For example, if to store the information of user, and the amount of business datum is very big, is that can not meet storage with single table Demand, then just can carry out hash with the numbering of user, it can be common that operated with remainder, if to divide 30 tables to store The information of user, then Customs Assigned Number is 1 user 1%30=1, then be there is in user_01 tables, as the numbering of user is 500, then 500%30=20, by the information Store of this user in the table of user_20.
(3) table is divided by md5 values
Assuming that to store the file of user's upload, if upload amount is big, the bottleneck problem of system is also brought along, than Such as, if it exceeds if 20000 files, the browse efficiency of file can be reduced under a database table.Can now use The user name of file is carried out md5 or is made of the md5 check values of file, can be hash with first 3 of md5, so most We can be obtained by 16^3=4096 table, every time when storage file, it is possible to preceding the 3 of the md5 values of filename To determine this file, which table this deposits for position.
Each table of above-mentioned preset rules generation corresponds to a sub- table model class.Specifically, ByteBuddy can be used The multiple sublist model classes of dynamic generation, naturally it is also possible to increased income class libraries using cglib and javaassist third parties, dynamically to give birth to Into multiple sublist model classes.These three class libraries are all to have used this class libraries of increasing income of asm, and it can be with dynamic operation Java section codes Construction Dynamic Java class
Registering modules 602, the sublist model class is registered for the configuration center in Open Framework.
Being registered to hibernate configuration center can be loaded using static mode, it would however also be possible to employ dynamical fashion is loaded.
Hibernate is typically, according to relevant configuration information when web container starts, to scan class files, then It is registered in SessionFactory, Java section codes can be operated to construct Dynamic Java class, specifically by writes java Assembly instruction serializing generation one class file, this class file is then loaded using classloader.
After the completion of starting in container, the class produced during normal program operation, because hibernate can not know The class of other this new establishment, now can not directly use the interface of hibernate.Now can by the way of dynamic registration come Carry out.In view of safety issue, original SessionFactory is not used now, but obtain SessionFactory, judges whether sublist model class is dynamically loaded into JVM, if it is, updating current Configuration, and re-create a SessionFactory.
Selecting module 603, for selecting to need to carry out the sublist model class of data manipulation in the sublist model class.
Ashing technique is defined, corresponding sublist model class is selected according to specific hash parameter, the hash parameter can be Other fields of model major key Id, or model, can also be time parameter etc..
For example, such as recording the database of all purchaser records of user, if all records put into In one table userbuy table, will certainly be very huge.So a point list processing can be carried out by user id, by different user Purchaser record be put into different points of tables.Specific practice is as follows:
Portfolio is estimated, by initial userbuy tables, 100 userbuy_index tables of identical table structure is expanded to, Former table structure is as shown in Table 1:
All of point of table uses identical table structure, and when newly-increased point of token record is needed, process is as follows:First Hash calculating is carried out to user id, hash values are obtained, the hash values necessarily 0-99, it is therefore an objective to by corresponding user id data, It is written in same point table, now, sublist model class just can be chosen based on the hash values.
Performing module 604, for the data manipulation function provided using the Open Framework, needs to carry out data to described The example of the sublist model class of operation performs corresponding data manipulation.
Use the data manipulation work(such as primary Hibernate data increase, data deletion, data modification and data query Can, the specific sublist model class of Explicit designation carries out associated data operation.A point table is specified by display, user can clearly specify It is which point table to initiate associated data operation to, user can clearly understand the physical data structure of data.
Specifically, by the example of constructor table model class, and example to the sublist model class carries out data manipulation To realize data manipulation function.During the example of tectonic model class, corresponding sublist model class is first selected according to hash parameter, then The model instance of correspondence subclass is constructed using method for reflection Class.newInstance (), the filling of set methods is finally reused Object.Why method for reflection is used, because corresponding sublist model class is dynamic definition.
Above-mentioned point of meter apparatus 60, in addition to including above-mentioned module, optionally, referring to Fig. 7, a point meter apparatus 60 can also be wrapped Include:
Definition module 701, for single table model class defined in the Open Framework.
Specifically, following code can be added in the configuration file hibernate.cfg.xml of Hibernate:
< properties >
< property name=" hibernate.hbm2ddl.auto " value=" create "/>
</properties >
By single table model class, the multiple sublist models that can be dynamically generated in step S101 defined in Open Framework During class, the single table model category code defined in de-multiplexing steps S201 while simplified code is write, is more convenient for carrying out code Safeguard.
Point meter apparatus in the present embodiment, realize simply, using simple, there is very strong intelligibility, are greatly reduced Cost and maintenance cost are practised, performance is close to the primary mono- table handlings of ORM.
Optionally, referring to Fig. 8, selecting module 603 can include:
Definition module 801, point table requirement definition ashing technique of the database for being associated based on the Open Framework;
Acquisition module 802, the preset field of the database for obtaining the Open Framework association;
Computing module 803, for carrying out data operation to the preset field based on the ashing technique;
Determining module 804, for being determined to need to carry out the sublist model of data manipulation according to the result of the data operation Class.
Optionally, referring to Fig. 9, performing module 604 can include:
Designated module 901, for the data increase, data deletion, data modification and the number that are provided using the Open Framework According to query function, the sublist model class for carrying out data manipulation is needed to carry out associated data operation described in Explicit designation;
Module 902 is built, for building the mould for needing to carry out the sublist model class of data manipulation using method for reflection Type example;
Filling module 903, for carrying out data filling using model instance described in the class set pair not comprising repeat element.
Content in Fig. 8-9 embodiments in the corresponding embodiment of the method for the function of each module is corresponding, herein no longer Repeat.
Figure 10 shows the structural representation of electronic equipment provided in an embodiment of the present invention 100, and electronic equipment 100 is included extremely A few processor 1001 (such as CPU), at least one input/output interface 1004, memory 1002, and at least one communication Bus 1003, for realizing the connection communication between these parts.At least one processor 1001 is used to perform memory 1002 The computer instruction of middle storage, so that at least one processor 1001 is able to carry out the implementation of foregoing any point of table method Example.Memory 1002 is non-transient memory (non-transitory memory), and it can include volatile memory, example Such as high-speed random access memory (RAM:Random Access Memory), it is also possible to including nonvolatile memory (non- Volatile memory), for example, at least one magnetic disk storage.(can have by least one input/output interface 1004 Line or wireless communication interface) realize and the communication connection between at least one other equipment or unit.
In some embodiments, memory 1002 stores program 10021, and the configuration processor 10021 of processor 1001 is used Content in foregoing any point of table embodiment of the method is performed.
The electronic equipment can exist in a variety of forms, including but not limited to:
(1) mobile communication equipment:The characteristics of this kind equipment is that possess mobile communication function, and to provide speech, data It is main target to communicate.This Terminal Type includes:Smart mobile phone (such as iPhone), multimedia handset, feature mobile phone, and it is low End mobile phone etc..
(2) super mobile personal computer equipment:This kind equipment belongs to the category of personal computer, there is calculating and treatment work( Can, typically also possess mobile Internet access characteristic.This Terminal Type includes:PDA, MID and UMPC equipment etc., such as iPad.
(3) portable entertainment device:This kind equipment can show and play content of multimedia.The kind equipment includes:Audio, Video player (such as iPod), handheld device, e-book, and intelligent toy and portable car-mounted navigation equipment.
(4) particular server:The equipment for providing the service of calculating, the composition of server includes processor, hard disk, internal memory, is System bus etc., server is similar with general computer architecture, but due to needing to provide highly reliable service, therefore in treatment The requirement of the aspects such as ability, stability, reliability, security, scalability, manageability is higher.
(5) other have the electronic equipment of data interaction function.
It should be noted that herein, such as first and second or the like relational terms are used merely to a reality Body or operation make a distinction with another entity or operation, and not necessarily require or imply these entities or deposited between operating In any this actual relation or order.And, term " including ", "comprising" or its any other variant be intended to Nonexcludability is included, so that process, method, article or equipment including a series of key elements not only will including those Element, but also other key elements including being not expressly set out, or also include being this process, method, article or equipment Intrinsic key element.In the absence of more restrictions, the key element limited by sentence " including ... ", it is not excluded that Also there is other identical element in the process including the key element, method, article or equipment.
Each embodiment in this specification is described by the way of correlation, identical similar portion between each embodiment Divide mutually referring to what each embodiment was stressed is the difference with other embodiment.
For especially for device embodiment, because it is substantially similar to embodiment of the method, so the comparing of description is simple Single, the relevent part can refer to the partial explaination of embodiments of method.
Represent in flow charts or logic and/or step described otherwise above herein, for example, being considered use In the order list of the executable instruction for realizing logic function, in may be embodied in any computer-readable medium, for Instruction execution system, device or equipment (such as computer based system, including the system of processor or other can be held from instruction The system of row system, device or equipment instruction fetch and execute instruction) use, or with reference to these instruction execution systems, device or set It is standby and use.For the purpose of this specification, " computer-readable medium " can any can be included, store, communicate, propagate or pass The dress that defeated program is used for instruction execution system, device or equipment or with reference to these instruction execution systems, device or equipment Put.The more specifically example (non-exhaustive list) of computer-readable medium includes following:With the electricity that one or more are connected up Connecting portion (electronic installation), portable computer diskette box (magnetic device), random access memory (RAM), read-only storage (ROM), erasable edit read-only storage (EPROM or flash memory), fiber device, and portable optic disk is read-only deposits Reservoir (CDROM).In addition, computer-readable medium can even is that the paper that can thereon print described program or other are suitable Medium, because optical scanner for example can be carried out by paper or other media, then enters edlin, interpretation or if necessary with it His suitable method is processed electronically to obtain described program, is then stored in computer storage.
It should be appreciated that each several part of the invention can be realized with hardware, software, firmware or combinations thereof.
In the above-described embodiment, multiple steps or method can in memory and by suitable instruction be performed with storage The software or firmware that system is performed are realized.If for example, being realized with hardware, with another embodiment, can use Any one of following technology well known in the art or their combination are realized:With for realizing logic work(to data-signal The discrete logic of the logic gates of energy, the application specific integrated circuit with suitable combinational logic gate circuit, programmable gate Array (PGA), field programmable gate array (FPGA) etc..
The above, specific embodiment only of the invention, but protection scope of the present invention is not limited thereto, and it is any Those familiar with the art the invention discloses technical scope in, the change or replacement that can be readily occurred in, all should It is included within the scope of the present invention.Therefore, protection scope of the present invention should be defined by scope of the claims.

Claims (10)

1. it is a kind of to divide table method, it is characterised in that including:
The multiple sublist model classes of dynamic generation;
The sublist model class is registered in the configuration center of Open Framework;
Select to need to carry out the sublist model class of data manipulation in the sublist model class;
The data manipulation function provided using the Open Framework, to the reality for needing to carry out the sublist model class of data manipulation Example performs corresponding data manipulation.
2. according to claim 1 point of table method, it is characterised in that the multiple sublist model classes of dynamic generation it Before, methods described also includes:
Single table model class defined in the Open Framework.
3. according to claim 1 point of table method, it is characterised in that the multiple sublist model classes of dynamic generation, including:
Obtain point table demand of the database of the Open Framework association;
Based on described point of table demand, being increased income using third party, class libraries is dynamic to generate multiple sublist model classes.
4. according to claim 1 point of table method, it is characterised in that the configuration center registration in Open Framework is described Sublist model class, including:
Generate the corresponding class file of the sublist model class;
The class file is stored in the default scan position of the Open Framework.
5. according to claim 1 point of table method, it is characterised in that the configuration center registration in Open Framework is described Sublist model class, including:
Obtain the session interface file of the Open Framework;
Based on the session interface file, judge whether the sublist model class is loaded using dynamical fashion;
When the sublist model class is loaded using dynamical fashion, the configuration file of the Open Framework is updated, and again Create the session interface file of the Open Framework.
6. according to claim 3 point of table method, it is characterised in that need to carry out in the selection sublist model class The sublist model class of data manipulation, including:
Point table requirement definition ashing technique of the database based on Open Framework association;
Obtain the preset field of the database of the Open Framework association;
Data operation is carried out to the preset field based on the ashing technique;
Result according to the data operation determines to need to carry out the sublist model class of data manipulation.
7. according to claim 1 point of table method, it is characterised in that the data behaviour provided using the Open Framework Make function, need the example for carrying out the sublist model class of data manipulation to perform corresponding data manipulation to described, including:
Data increase, data deletion, data modification and the data query function provided using the Open Framework, Explicit designation institute Stating needs the sublist model class for carrying out data manipulation to carry out associated data operation.
8. according to claim 7 point of table method, it is characterised in that the data behaviour provided using the Open Framework Make function, need the example for carrying out the sublist model class of data manipulation to perform corresponding data manipulation to described, also include:
The model instance for needing to carry out the sublist model class of data manipulation is built using method for reflection;
Data filling is carried out using model instance described in the class set pair not comprising repeat element.
9. it is a kind of to divide meter apparatus, it is characterised in that including:
Generation module, for the multiple sublist model classes of dynamic generation;
Registering modules, the sublist model class is registered for the configuration center in Open Framework;
Selecting module, for selecting to need to carry out the sublist model class of data manipulation in the sublist model class;
Performing module, for the data manipulation function provided using the Open Framework, needs to carry out data manipulation to described The example of sublist model class performs corresponding data manipulation.
10. a kind of electronic equipment, it is characterised in that the electronic equipment includes:
At least one processor;And,
The memory being connected with least one processor communication;Wherein,
The memory storage has can be by the instruction of at least one computing device, and the instruction is by described at least one Reason device is performed, so that at least one processor is able to carry out point table method described in foregoing any claim 1-8.
CN201710023995.7A 2017-01-12 2017-01-12 One kind divides table method, apparatus and electronic equipment Active CN106886568B8 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710023995.7A CN106886568B8 (en) 2017-01-12 2017-01-12 One kind divides table method, apparatus and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710023995.7A CN106886568B8 (en) 2017-01-12 2017-01-12 One kind divides table method, apparatus and electronic equipment

Publications (3)

Publication Number Publication Date
CN106886568A true CN106886568A (en) 2017-06-23
CN106886568B CN106886568B (en) 2018-03-30
CN106886568B8 CN106886568B8 (en) 2018-05-01

Family

ID=59176381

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710023995.7A Active CN106886568B8 (en) 2017-01-12 2017-01-12 One kind divides table method, apparatus and electronic equipment

Country Status (1)

Country Link
CN (1) CN106886568B8 (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107423387A (en) * 2017-07-19 2017-12-01 北京北信源软件股份有限公司 The method and apparatus of table is divided in a kind of point storehouse based on middleware
CN108108434A (en) * 2017-12-19 2018-06-01 福建中金在线信息科技有限公司 A kind of method and device for managing database
CN108334576A (en) * 2018-01-24 2018-07-27 深圳市金政软件技术有限公司 A kind of data exhibiting system and its method for exhibiting data
CN111026985A (en) * 2019-12-02 2020-04-17 北京齐尔布莱特科技有限公司 Short link generation method, device and server
CN111177148A (en) * 2019-12-06 2020-05-19 南京南瑞水利水电科技有限公司 Method for automatically building and dividing tables of hydropower database
CN111199386A (en) * 2019-12-27 2020-05-26 天阳宏业科技股份有限公司 Workflow engine and implementation method thereof

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101697152A (en) * 2009-10-23 2010-04-21 金蝶软件(中国)有限公司 Database storage system and method and device for splitting data thereof
CN102682044A (en) * 2011-04-14 2012-09-19 天脉聚源(北京)传媒科技有限公司 Method for splitting tables for PHP MYSQL database
CN102867071A (en) * 2012-10-19 2013-01-09 烽火通信科技股份有限公司 Management method for massive network management historical data
CN103678609A (en) * 2013-12-16 2014-03-26 中国科学院计算机网络信息中心 Large data inquiring method based on distribution relation-object mapping processing
CN105550349A (en) * 2015-12-28 2016-05-04 北京邮电大学 Persistent layer device and database operation method

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101697152A (en) * 2009-10-23 2010-04-21 金蝶软件(中国)有限公司 Database storage system and method and device for splitting data thereof
CN102682044A (en) * 2011-04-14 2012-09-19 天脉聚源(北京)传媒科技有限公司 Method for splitting tables for PHP MYSQL database
CN102867071A (en) * 2012-10-19 2013-01-09 烽火通信科技股份有限公司 Management method for massive network management historical data
CN103678609A (en) * 2013-12-16 2014-03-26 中国科学院计算机网络信息中心 Large data inquiring method based on distribution relation-object mapping processing
CN105550349A (en) * 2015-12-28 2016-05-04 北京邮电大学 Persistent layer device and database operation method

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
姚振宇: "数据库动态生成表在Hibernate中映射问题的研究与解决", 《计算机与现代化》 *

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107423387A (en) * 2017-07-19 2017-12-01 北京北信源软件股份有限公司 The method and apparatus of table is divided in a kind of point storehouse based on middleware
CN108108434A (en) * 2017-12-19 2018-06-01 福建中金在线信息科技有限公司 A kind of method and device for managing database
CN108334576A (en) * 2018-01-24 2018-07-27 深圳市金政软件技术有限公司 A kind of data exhibiting system and its method for exhibiting data
CN111026985A (en) * 2019-12-02 2020-04-17 北京齐尔布莱特科技有限公司 Short link generation method, device and server
CN111177148A (en) * 2019-12-06 2020-05-19 南京南瑞水利水电科技有限公司 Method for automatically building and dividing tables of hydropower database
CN111199386A (en) * 2019-12-27 2020-05-26 天阳宏业科技股份有限公司 Workflow engine and implementation method thereof

Also Published As

Publication number Publication date
CN106886568B (en) 2018-03-30
CN106886568B8 (en) 2018-05-01

Similar Documents

Publication Publication Date Title
CN106886568B (en) One kind divides table method, apparatus and electronic equipment
US8108367B2 (en) Constraints with hidden rows in a database
CN103365646B (en) Form user-defined, logical definition and processing method based on script engine
US7251653B2 (en) Method and system for mapping between logical data and physical data
US10915532B2 (en) Supporting a join operation against multiple NoSQL databases
CN103377038B (en) The description of customizing form and list analytic method
CN101566986A (en) Method and device for processing data in online business processing
US7720831B2 (en) Handling multi-dimensional data including writeback data
US11216474B2 (en) Statistical processing of natural language queries of data sets
CN108664516A (en) Enquiring and optimizing method and relevant apparatus
Holzschuher et al. Querying a graph database–language selection and performance considerations
CN106407303A (en) Data storage method and apparatus, and data query method and apparatus
US9176997B2 (en) Universe migration from one database to another
US11100173B2 (en) Autolayout of visualizations based on graph data
CN104750727B (en) A kind of column memory storage inquiry unit and column memory storage querying method
US7877417B2 (en) Method and apparatus for exchanging data with a database
US8028000B2 (en) Data storage structure
CN104408073B (en) Data manipulation method and device
CN107085600A (en) POI recommends method, device, equipment and computer-readable recording medium
US9652740B2 (en) Fan identity data integration and unification
US11036797B2 (en) Efficient storage and utilization of a hierarchical data set
CN107832448A (en) Database operation method, device and equipment
CN109815238A (en) The dynamic adding method and device of database are realized with strict balanced binary tree
CN103049494B (en) Method and device for storing table of extensible markup language (XML) file
CN110720097A (en) Functional equivalence of tuples and edges in graph databases

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
GR01 Patent grant
GR01 Patent grant
CB03 Change of inventor or designer information
CB03 Change of inventor or designer information

Inventor after: Qian Wenpin

Inventor after: Liu Weiping

Inventor after: Wang Liang

Inventor after: Yu Fei

Inventor after: Chen Chao

Inventor before: Qian Wenpin

Inventor before: Yu Fei

Inventor before: Chen Chao

CI03 Correction of invention patent
CI03 Correction of invention patent

Correction item: Inventor

Correct: Qian Wenpin|Liu Weiping|Wang Liang|Yu Fei|Chen Chao

False: Qian Wenpin|Yu Fei|Chen Chao

Number: 13-02

Page: The title page

Volume: 34

Correction item: Inventor

Correct: Qian Wenpin|Liu Weiping|Wang Liang|Yu Fei|Chen Chao

False: Qian Wenpin|Yu Fei|Chen Chao

Number: 13-02

Volume: 34