CN102156735A - Implementation method and device of business method based on database transaction - Google Patents

Implementation method and device of business method based on database transaction Download PDF

Info

Publication number
CN102156735A
CN102156735A CN 201110090410 CN201110090410A CN102156735A CN 102156735 A CN102156735 A CN 102156735A CN 201110090410 CN201110090410 CN 201110090410 CN 201110090410 A CN201110090410 A CN 201110090410A CN 102156735 A CN102156735 A CN 102156735A
Authority
CN
China
Prior art keywords
field object
operational approach
buffer
object buffer
issued transaction
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
CN 201110090410
Other languages
Chinese (zh)
Other versions
CN102156735B (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.)
CHINA NONFERROUS METAL MINING (GROUP) Co Ltd
Original Assignee
CHINA NONFERROUS METAL MINING (GROUP) 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 CHINA NONFERROUS METAL MINING (GROUP) Co Ltd filed Critical CHINA NONFERROUS METAL MINING (GROUP) Co Ltd
Priority to CN 201110090410 priority Critical patent/CN102156735B/en
Publication of CN102156735A publication Critical patent/CN102156735A/en
Application granted granted Critical
Publication of CN102156735B publication Critical patent/CN102156735B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses an implementation method and device of a business method based on database transaction. The business method of executing a business object by a business object agent comprises the following steps of: starting the transaction for the business method and clearing a preset domain object buffer when the current business method to be executed is the business method invoked by the outermost layer, wherein the business method comprises the following steps of: changing a similar business method, executing the business method, and invoking a pre-generated domain object agent to put a domain object changed in the business method in a corresponding domain object buffer; performing the transaction when the business method is successfully executed, wherein the transaction comprises the steps of storing the domain object in the domain object buffer in the database, and/or deleting the domain object in the domain object buffer from the database; and closing the transaction after the transaction is submitted and the domain object buffer is cleared. In the invention, transaction logics in the business method are completely eliminated, the logicality and maintainability of applications are improved, and the coupling degree, redundancy rate and the like are reduced.

Description

A kind of operational approach manner of execution and device of handling based on db transaction
Technical field
The present invention relates to the mutual technical field of object-oriented and database, particularly relate to a kind of operational approach manner of execution and a kind of operational approach actuating unit of handling based on db transaction of handling based on db transaction.
Background technology
Db transaction (Database Transaction) is meant the sequence of operations of carrying out as single logical unit of work.Unless issued transaction can be guaranteed all operations in the transactional unit and all complete successfully, otherwise can forever not upgrade data-oriented resource.By one group of associative operation being combined as whole successes or the unit of all failing, can simplifying wrong recovery and make application program more reliable.
Particularly, if one group of treatment step or all take place or a step does not carry out yet claims that then this group treatment step is affairs.Intactly carried out as an operation when all steps, claimed that then these affairs are submitted.Because a part wherein or multistep are carried out failure, cause not having step submitted, then affairs must rollback (getting back to initial unit state).Affairs must be obeyed the ACID principle that ISO/IEC formulates.ACID is the abbreviation of atomicity (atomicity), consistance (consistency), isolation (isolation) and persistence (durability).The atomicity of affairs is represented any modification inefficacy that any failure in the affairs implementation all will cause office to be made.Consistance represents that when affairs are carried out failure all should be returned to affairs by the data of this business-impacting and carry out preceding state.Isolation is illustrated in the affairs implementation modification to data, and is invisible to other affairs before affairs are submitted to.The data that persistence is represented to have submitted to are when affairs are carried out failure, and the state of data all should be correct.
Carry out application for the operational approach that needs carry out handling based on db transaction, have several operational approaches to carry out business processing usually.Business processing usually can be newly-built, deletion, renewal and data query, by issued transaction data are extracted from database, and with newly-built in the business processing process, upgrade or the data storage of deletion is deleted in database or from database.Issued transaction can be realized by multiple technologies, mainly comprises database interface or object/relationship map technology, as ODBC, OCI, JDBC, Hibernate etc.No matter adopt which kind of transaction processing facility, all need embed the correspondent transaction processing logic in operational approach, this has mainly brought two aspect problems:
The first, need in each operational approach, add issued transaction logic and corresponding exception handling logic, not only destroy the logicality of operational approach, also be unfavorable for the work such as debugging, maintenance, upgrading of operational approach;
Second, generally, each operational approach all needs an issued transaction, before operational approach is carried out business processing, issued transaction is opened, after carrying out business processing, issued transaction is submitted to, or in carrying out business processing, encounter problems the issued transaction rollback, close issued transaction then, an operational approach implementation is exactly in fact an issued transaction process.If do not relate to newly-built, renewal or deleted data business processing in the operational approach, then do not need to submit to or the rollback issued transaction.And, when certain operational approach need be carried out other operational approach and finishes more complicated service and handle, then need to realize operational approach again, and can not carry out on the original basis simply carrying out mutually.
For example, operational approach A has successively carried out operational approach B and operational approach C, and outermost operational approach A has an issued transaction Ta, and its coverage has contained operational approach A, B and C, issued transaction Tb among operational approach B and the C and Tc are unnecessary, and can bring spinoff.For example, gross error when carrying out operational approach C, business processing takes place, then need all issued transaction of rollback, but the issued transaction Tb of B submits to and is through with at this moment, even the issued transaction Ta of operational approach A and C and Tc can not submit to, also the issued transaction Tb that operational approach B can't have been submitted to carries out rollback, and the ACID principle that this has seriously run counter to issued transaction will cause catastrophic consequence.In this case, adopt prior art need realize operational approach A again, the business processing logic of operational approach A, B, C is brought in the issued transaction, remove original issued transaction among operational approach B and the C.Adopt such operation will bring very big workload, and can produce the serious code redundancy and the high degree of coupling, be unfavorable for safeguarding and increasing work efficiency.And above-mentioned two problems influences each other, and also can further aggravate to use executory problem.
Summary of the invention
Technical matters to be solved by this invention provides a kind of operational approach manner of execution and device of handling based on db transaction, normally to carry out under the prerequisite of issued transaction guaranteeing, remove the issued transaction interrelated logic in the operational approach fully, improve logicality, the readability and maintainable used, and lower the degree of coupling and the redundance of using, improve data-handling efficiency.
In order to solve the problems of the technologies described above, the embodiment of the invention discloses a kind of operational approach manner of execution of handling based on db transaction, comprising:
Generate corresponding service object broker device at newly-built business object, when carrying out the operational approach of described business object, carry out following treatment step by described business object proxy server:
Current pending operational approach be outermost layer call operational approach the time, be that this operational approach opens issued transaction, and empty the field object buffer that presets; Wherein, described operational approach comprises change class operational approach;
Carry out described operational approach, and call the field object proxy server that generates in advance the field object that changes in the described operational approach is put into corresponding field object buffer;
When described operational approach runs succeeded, carry out issued transaction, described issued transaction comprises: the field object in the described field object buffer stored in the database, and/or, the field object of appointment in the described field object buffer of deletion from database;
After submitting issued transaction to and emptying described field object buffer, close issued transaction.
Preferably, described method also comprises:
When described operational approach is carried out failure, the rollback issued transaction and empty described field object buffer after, close issued transaction.
Preferably, be provided with operational approach call stack first-in last-out in the described business object proxy server, described method also comprises:
Before carrying out the current business method, judge whether described operational approach call stack is empty, if empty, determine that then the current business method is the operational approach that outermost layer calls;
After opening issued transaction, the current business method is pressed into described operational approach call stack.
Preferably, described method also comprises:
If described operational approach call stack is not empty, then do not open issued transaction, directly the current business method is pressed into described operational approach call stack.
Preferably, described method also comprises:
After carrying out the current business method, judge whether have only an element in the described operational approach call stack, if then after submitting issued transaction to, empty described operational approach call stack;
If not, then directly this operational approach is popped from described operational approach call stack.
Preferably, the described field object buffer that presets comprises newly-built field object buffer, upgrades field object buffer and deletion field object buffer, and the step that the described field object proxy server that calls generation is in advance put into corresponding field object buffer with the field object that changes in the operational approach comprises:
By the newly-built field object of field object proxy server that generates in advance, and newly-built field object put into described newly-built field object buffer;
And/or,
Upgrade field object by the field object proxy server that generates in advance, and the field object that upgrades is put into described renewal field object buffer, the field object of described renewal has corresponding property value;
And/or,
By the field object proxy server that generates in advance the field object of deletion is put into described deletion field object buffer;
The described step that field object in the field object buffer is stored in the database is that the field object in newly-built field object buffer, the renewal field object buffer is stored in the database;
Described step of deleting the field object of appointment in the field object buffer from database is the field object from database in the described deletion field object buffer of deletion.
Preferably, described issued transaction also comprises:
According to increase the field object buffer, upgrade the field object buffer, the order of deletion field object buffer stores field object in the database or from database into successively and deletes,
Preferably, before carrying out issued transaction, described method also comprises:
Whether judge described newly-built field object buffer, upgrade the field object buffer and delete the field object buffer all is empty;
If not, then judge the field object in the deletion field object buffer, whether be present in the newly-built field object buffer;
If exist, then this field object is deleted from described newly-built field object buffer, renewal field object buffer and deletion field object buffer.
Preferably, described operational approach also comprises inquiry class operational approach, and the step of described execution operational approach also comprises:
Call the field object proxy server that generates in advance, directly carry out correlation method the specified domain object;
Described method also comprises:
When described newly-built field object buffer, renewal field object buffer and deletion field object buffer all are sky, directly close issued transaction.
The embodiment of the invention also discloses a kind of operational approach actuating unit of handling based on db transaction, comprising:
The business object proxy server generates at newly-built business object, is used to carry out the operational approach of described business object, specifically comprises with lower module:
The affairs opening module, be used for current pending operational approach be outermost layer call operational approach the time, be that this operational approach opens issued transaction, and empty the field object buffer that presets; Wherein, described operational approach comprises change class operational approach;
The operational approach execution module is used to carry out described operational approach, and calls the field object proxy server that generates in advance the field object that changes in the described operational approach is put into corresponding field object buffer;
The issued transaction module, be used for carrying out issued transaction when described operational approach runs succeeded, described issued transaction comprises: the field object in the described field object buffer is stored in the database, and/or, the field object of appointment in the described field object buffer of deletion from database;
Affairs are submitted closing module to, after being used to submit to issued transaction and emptying described field object buffer, close issued transaction.
Preferably, described business object proxy server also comprises:
The transaction rollback closing module is used for when described operational approach is carried out failure, the rollback issued transaction and empty described field object buffer after, close issued transaction.
Preferably, be provided with operational approach call stack first-in last-out in the described business object proxy server, described business object proxy server also comprises:
The call stack judge module is used for before carrying out the current business method, judges whether described operational approach call stack is empty, if empty, determines that then the current business method is the operational approach that outermost layer calls;
The first pop down module is used for after opening issued transaction the current business method being pressed into described operational approach call stack.
Preferably, described business object proxy server also comprises:
The second pop down module, it is not empty being used at described operational approach call stack, when not opening issued transaction, directly the current business method is pressed into described operational approach call stack.
Preferably, described business object proxy server also comprises:
Outermost layer method verification module is used for judging whether have only an element in the described operational approach call stack after carrying out the current business method, if then after submitting issued transaction to, trigger call stack and empty module; If not, then trigger the module of popping;
Call stack empties module, is used to empty described operational approach call stack;
The module of popping is used for directly this operational approach being popped from described operational approach call stack.
Preferably, the described field object buffer that presets comprises newly-built field object buffer, upgrades field object buffer and deletion field object buffer, and described field object proxy server specifically comprises:
The newly-built module of field object is used for newly-built field object, and newly-built field object is put into described newly-built field object buffer;
And/or,
The field object update module is used to upgrade field object, and the field object that upgrades is put into described renewal field object buffer, and the field object of described renewal has corresponding property value;
And/or,
The field object removing module is used for the field object of deletion is put into described deletion field object buffer;
Described issued transaction module specifically comprises:
Database writes submodule, is used for the field object of newly-built field object buffer, renewal field object buffer is stored in the database;
And/or,
Database deletion submodule is used for the field object from the described deletion field object buffer of database deletion.
Preferably, described issued transaction module also comprises:
The database manipulation submodule, be used for according to increase the field object buffer, upgrade the field object buffer, the order of deletion field object buffer stores field object into database successively or deletes from database,
Preferably, described business object proxy server also comprises:
The buffer memory judge module is used for before carrying out issued transaction, and whether judge described newly-built field object buffer, upgrade the field object buffer and delete the field object buffer all is empty; If not, then trigger the buffer memory adjusting module;
The buffer memory adjusting module is used for the field object at deletion field object buffer, when being present in the newly-built field object buffer, this field object is deleted from described newly-built field object buffer, renewal field object buffer and deletion field object buffer.
Preferably, described operational approach also comprises inquiry class operational approach, and described field object proxy server also comprises the field object enquiry module, and described field object enquiry module is used to carry out the correlation method to the specified domain object; Described operational approach execution module also comprises:
Directly implementation sub-module is used to carry out operational approach, and calls the field object enquiry module of described field object proxy server;
Described business object proxy server also comprises:
The affairs closing module is used at described newly-built field object buffer, upgrades the field object buffer and delete the field object buffer when all being sky, directly closes issued transaction.
Compared with prior art, the present invention has the following advantages:
The present invention removes the logic of issued transaction and relevant abnormalities processing in the operational approach of business object, only carry out the realization of service logic.By pregenerated business object proxy server when carrying out the operational approach of business object, in the operational approach implementation, by pregenerated field object proxy server will change (comprise newly-increased, upgrade, deletion and/or inquiry) field object insert in the buffer that presets, and open an issued transaction; After operational approach is finished, by the business object proxy server of operational approach place business object, the field object in the buffer stored in the database or from database delete, and submit issued transaction to, perhaps when running into problem, the rollback issued transaction; Close issued transaction then.Above-mentioned issued transaction process, field object process of caching, exception handling procedure are transparent for operational approach and user thereof.Like this, not only can remove issued transaction and relevant abnormalities processing logic fully from operational approach, also can realize carrying out mutually between method flexibly, whenever a business processing has only an issued transaction process; And issued transaction, abnormality processing centralized management effectively can have been improved logicality, the maintainability used, reduce the degree of coupling, redundance etc.
Description of drawings
Fig. 1 is the flow chart of steps of a kind of operational approach manner of execution embodiment 1 that handles based on db transaction of the present invention;
Fig. 2 is the flow chart of steps of a kind of operational approach manner of execution embodiment 2 that handles based on db transaction of the present invention;
Fig. 3 is the structured flowchart of a kind of operational approach actuating unit embodiment that handles based on db transaction of the present invention.
Embodiment
For above-mentioned purpose of the present invention, feature and advantage can be become apparent more, the present invention is further detailed explanation below in conjunction with the drawings and specific embodiments.
One of core idea of the embodiment of the invention is, removes the logic that issued transaction and relevant abnormalities are handled in the operational approach of business object, only carries out the realization of service logic.Be specially, by pregenerated business object proxy server when carrying out the operational approach of business object, in the operational approach implementation, by pregenerated field object proxy server will change (comprise newly-increased, upgrade, deletion and/or inquiry) field object insert in the buffer that presets, and open an issued transaction; After operational approach is finished, by the business object proxy server of operational approach place business object, the field object in the buffer stored in the database or from database delete, and submit issued transaction to, perhaps when running into problem, the rollback issued transaction; Close issued transaction then.Above-mentioned issued transaction process, field object process of caching, exception handling procedure are transparent for operational approach and user thereof.Like this, not only can from operational approach, remove issued transaction and relevant abnormalities processing logic fully, also can realize carrying out mutually between method flexibly.
With reference to figure 1, show the flow chart of steps of a kind of operational approach manner of execution embodiment 1 that handles based on db transaction of the present invention, in embodiments of the present invention, need generate corresponding service object broker device at newly-built business object, by the operational approach of described business object proxy server on behalf of this business object of execution.
In specific implementation, " proxy mode " that can use in " GOF Design Mode " encapsulates the operational approach of business object.When a newly-built business object, can generate a corresponding business object broker device by business object proxy server factory, described business object proxy server is carried out the corresponding service method of its agency's business object in internalist methodology, so can before and after this method is carried out, do corresponding processing according to the type of this method.
In embodiments of the present invention, described business object is used to the logic of managing business, and can handle several relevant field objects by the field object proxy server.For example, the operational approach of business object in the process of implementation can be newly-built by the field object proxy server, upgrade, delete and inquire about several field objects, carries out when finishing in operational approach, these field objects stored in the database or from database delete.In the operational approach of described business object, removed issued transaction and relevant exception handling logic, issued transaction and relevant abnormalities are handled and are transferred to the realization of business object proxy server.
Particularly, when carrying out the operational approach of described business object, carry out following treatment step by described business object proxy server:
Step 101, current pending operational approach be outermost layer call operational approach the time, be that this operational approach opens issued transaction, and empty the field object buffer that presets; Wherein, described operational approach comprises change class operational approach;
In embodiments of the present invention, the operational approach that described outermost layer calls is meant and is positioned at the outermost operational approach of calling logic, perhaps can be understood as, be positioned at when time outermost operational approach of actuating logic, more specifically, the operational approach that outermost layer calls is exactly to finish the method that certain business processing is directly called, and additive method may be called in this method inside, and additive method is not outermost operational approach.For example, operational approach A has carried out operational approach B and operational approach C, and operational approach A is the operational approach that outermost layer calls so.Again for example, in certain business processing process, operational approach D finishes the operational approach that certain business processing is directly called, and then this moment, D was the operational approach that outermost layer calls; In business processing process next time, operational approach D finishes the operational approach that certain business processing is called by other operational approaches, and then this moment, D was not the operational approach that outermost layer calls.In the process of implementation, any operational approach can be outermost, also can not be, has increased dirigibility, not be used in to write deadly in the program, but is gone on behalf of judging whether it is the operational approach that outermost layer calls by the business object proxy server, thereby carries out issued transaction.
This step was carried out before operational approach is carried out, promptly before carrying out current pending operational approach, whether can prejudge current pending operational approach is the operational approach that outermost layer calls, if, then can open issued transaction for this operational approach by the issued transaction object, and empty the field object buffer that presets, prepare to carry out issued transaction; If current pending operational approach is not the operational approach that outermost layer calls, illustrate that then this operational approach carried out by other operational approaches, issued transaction is opened, and need not to do open operation.In practice, those skilled in the art can adopt any mode to judge whether current pending operational approach is the operational approach that outermost layer calls, and for example, the mode of calling counter are set, the mode of storehouse etc., and the present invention does not limit this.
In embodiments of the present invention, the operational approach of described change class is meant the operational approach that need carry out alter operation to field object, and the described alter operation that field object is carried out mainly comprises newly-built, the renewal of field object and deletion action.For example; realize in the business object that the method name of query logic is by beginnings such as " get ", " find ", " query ", " fetch "; these methods can not carried out alter operation to field object; be called the inquiry class methods; and there is the title of the method for alter operation to can't help " get ", " find ", " query " and beginnings such as " fetch " to any field object; be called the change class methods; these class methods are the inquiry of portion's execution within it class methods usually, and then the object or other object that inquire are made alter operation.
According to the alter operation type of described field object, corresponding field object buffer can be set.Promptly in a kind of preferred embodiment of the present invention, the described field object buffer that presets can comprise newly-built field object buffer, upgrade field object buffer and deletion field object buffer.These buffers be collect newly-built, upgrade and the container of the field object of deletion, be generally the collection class container, in practice, can be with the ID of field object foundation as the different elements of difference.Field object is carried out buffer memory in the business processing process, then the field object of buffer memory is stored in the database or from database after business processing is finished and delete by transaction processing facility.
Certainly, the setting of above-mentioned field object buffer is only as example, it all is feasible that those skilled in the art adopt any mode to be provided with according to actual conditions, for example, a field object buffer only is set, but to the field object recording operation type that writes buffer (as newly-increased, upgrade and deletion) sign etc., the present invention need not this to be limited.
Step 102, carry out described operational approach, and call the field object proxy server that generates in advance the field object that changes in the described operational approach is put into corresponding field object buffer;
Operational approach for the change class can relate to the operation of changing field object.In embodiments of the present invention, can the field object that change in the described operational approach be put into corresponding field object buffer by the field object proxy server; Be provided with newly-built field object buffer, upgrading under the situation of field object buffer and deletion field object buffer, the step that the described field object proxy server that calls generation is in advance put into corresponding field object buffer with the field object that changes in the operational approach can comprise following substep:
Substep S11, by the newly-built field object of field object proxy server that generates in advance, and newly-built field object put into described newly-built field object buffer;
And/or,
Substep S12, upgrade field object by the field object proxy server that generates in advance, and the field object that upgrades is put into described renewal field object buffer, the field object of described renewal has corresponding property value;
And/or,
Substep S13, the field object of deletion is put into described deletion field object buffer by the field object proxy server that generates in advance.
In the invention process, described field object is derived from basic field object, and one or more tables of data corresponding in the database not only comprise entity object, also comprises the affiliated partner of many-to-many relationship between the embodiment entity object etc.Field object can comprise several attributes and method, and the title of getattr value method can be with " get " beginning, and the title of the method that sets property can be with " set " beginning, and the additive method name can not start with " get " and " set ".The constructed fuction that needs implicit expression or explicit execution basis field object in the constructed fuction of field object is to obtain ID.
Ancestors' class that described basic field object is a field object comprises a unique identification Property ID and a method " destroy () ".Wherein, ID is the major key of field object corresponding record in tables of data, and the ID type is generally long.In particular cases, if major key is a compound primary key, then the type of corresponding ID is an assisted class.In the constructed fuction of basic field object,, make field object when being created, be assigned with the relevant ID of a subclass by third party ID maker.Need to prove to have identical ID between different subclasses, but ID can not repeat between same subclass." destroy () " be of basic field object public, can not heritable, no rreturn value, parameterless short side method, the effect of this method is when object is deleted, notice field object proxy server.
When newly-built field object, can obtain a field object proxy server by field object proxy server factory, when carrying out certain method of field object by the field object proxy server on behalf of execution.Described field object proxy server is carried out the correlation method of its agency's field object in internalist methodology, so can be before and after this method be carried out, do corresponding additional treatments according to Method type, these Method types comprise that field object is newly-built, upgrade, delete, inquire about and other.Below just the four class scenes that excite of user describe, here " user " typically refers to " business object ":
1, during the newly-built field object of user, the field object proxy server knows that the building method that needs to carry out institute's Agent Domain object comes new Object, so carry out the building method of this field object, the field object that will newly create joins in the newly-built field object buffer then.
When 2, the user upgrades field object, the field object proxy server is by the method name of " set " beginning, know that needing to carry out institute's Agent Domain object respective attributes method to set up comes this field object is upgraded, then carry out the respective attributes method to set up of this field object earlier, then this field object is joined and upgrade in the field object buffer, if upgrade a copy of existing this object in the field object buffer, then upgrading this copy with this field object property value, is up-to-date with the property value that guarantees this field object in the renewal field object buffer.
When 3, the user deletes field object, need earlier this field object of cleaning with the dependence of other field objects and by dependence, make this field object become isolated object, explicitly is carried out destroy () method then, after its field object proxy server is seen the method name, know the operation that needs to carry out this field object of deletion, then this field object is joined in the deletion field object buffer.
When 4, the user obtained the value of certain attribute or carries out other method, the field object proxy server was not known and need be done additional treatments by the method name, directly carries out the corresponding method of this field object.
This four classes scene is general for all field objects, so the field object proxy server can be general, so just newly-built field object buffer, the operation logic that upgrades field object buffer and deletion field object buffer can be defined in one or a few field object proxy server.
Step 103, when described operational approach runs succeeded, carry out issued transaction, described issued transaction comprises: the field object in the described field object buffer stored in the database, and/or, the field object of appointment in the described field object buffer of deletion from database;
The field object of change can be placed into buffer in the operational approach implementation, after operational approach is complete, by transaction processing facility the field object of buffer memory is stored in the database or from database and to delete.
Put into respectively under the situation of each field object buffer in the field object that change the is arranged action type corresponding according to it, described with the field object in the field object buffer store in the database step can for, newly-built field object buffer, the field object that upgrades in the field object buffer are stored in the database; Described from database in the deletion field object buffer step of the field object of appointment can be, the field object from database in the described deletion field object buffer of deletion.
In specific implementation, more preferably, according to increase the field object buffer, upgrade the field object buffer, the order of deletion field object buffer stores field object in the database or from database into successively and deletes.
Certainly, the interactive mode of above-mentioned field object buffer and database is only as example, it all is feasible that those skilled in the art adopt any mode to be provided with according to actual conditions, for example, under the situation that only is provided with a field object buffer, to writing the field object recording operation type identification of buffer, after operational approach is complete, need carry out when mutual with database, then deposit field object in the database (action type is designated newly-built or upgrades) according to the field object action type sign that writes down in the buffer, perhaps, from database, delete field object (action type is designated deletion); Those skilled in the art can also adopt the interactive mode of other field object buffer and database, and the present invention need not this to be limited.
Step 104, submit issued transaction to and empty described field object buffer after, close issued transaction.
In specific implementation,, finish the implementation of current business method if no problem generation in the operational approach implementation is then submitted to, empties the field object buffer, closed the operation of issued transaction according to Executive Office reason.
The processing procedure of above-mentioned operational approach is general for all business objects, so the business object proxy server can be general, so just issued transaction and corresponding abnormality processing can be focused in one or a few business object proxy server.
Need to prove that in embodiments of the present invention, basic field object can catching exception, but do not handle unusually that the back of only will classifying is unusually thrown toward outer actuating logic, normally field object proxy server.Field object can catching exception, but does not handle unusually, and throw toward outer actuating logic, normally field object proxy server the back of only will classifying unusually.The field object proxy server can catching exception, but does not handle unusually, and throw toward outer actuating logic, normally business object the back of only will classifying unusually.Business object can catching exception, but does not handle unusually, and throw toward outer actuating logic, normally business object proxy server the back of only will classifying unusually.
When carrying out operational approach, the business object proxy server can be caught unusual that business object dishes out and, and handles, for severely subnormal, then interrupting service is handled, and Executive Office's reason rollback immediately, empties the field object buffer, closes cleaning work such as issued transaction.For not serious unusual, can only make journalizing, handle without interrupting service.
In embodiments of the present invention, the effect of proxy server (comprising business object proxy server, field object proxy server) is to provide a kind of agency with the visit of control to this object for destination object (by agent object).Do not think or can not directly use under the situation of destination object the user, and proxy server can play the effect of intermediary between user and destination object.The user is using destination object indirectly by proxy server, and proxy server can be done some additional treatments in the method implementation of destination object, as issued transaction, abnormality processing etc.Wherein, described user can be indication business object in this instructions usually, or is more senior service object, application etc.
With reference to figure 2, show the flow chart of steps of a kind of operational approach manner of execution embodiment 2 that handles based on db transaction of the present invention, in embodiments of the present invention, generate corresponding service object broker device at newly-built business object, by the operational approach of described business object proxy server on behalf of the described business object of execution.Because the operational approach of business object allows to carry out mutually,, an operational approach call stack first-in last-out can be set in the business object proxy server for actuating logic between the record traffic method and order.And, the issued transaction object of an overall situation is set in the business object proxy server, to guarantee carrying out operational approach in a transaction, whenever problem takes place can unify rollback, if no problem generation, then unified submission the to.
Particularly, when carrying out the operational approach of described business object, carry out following treatment step by described business object proxy server:
Step 201, before carrying out the current business method, judge whether described operational approach call stack is empty, if then change step 202; If not, then change step 203;
If described operational approach call stack is empty, illustrate that then the current business method is positioned at this actuating logic outermost layer, so can open issued transaction by the issued transaction object, and empty newly-built field object buffer, upgrade the field object buffer and delete the field object buffer, prepare to carry out issued transaction; If described operational approach call stack is not empty, illustrate that then the current business method carried out by other operational approaches, issued transaction is opened, and need not to do affairs and handles open operation.
Step 202, determine that the current business method is the operational approach that outermost layer calls, open issued transaction, and empty the field object buffer that presets; Wherein, described operational approach comprises change class operational approach; Change step 203 then;
Step 203, the current business method is pressed into described operational approach call stack, changes step 204;
Step 204, obtain the type of described operational approach, if the inquiry class methods, then execution in step 205; If the change class methods, then execution in step 206;
Step 205, the described inquiry class operational approach of execution are specially, and call the field object proxy server that generates in advance, directly carry out the correlation method to the specified domain object, change step 207 then;
If the inquiry class methods because these methods can not carried out alter operation to field object, thereby can not influence newly-built field object buffer, upgrade the field object buffer and delete the field object buffer, promptly can in above-mentioned field object buffer, not put into field object.
As a kind of example of concrete application, when the value of obtaining certain attribute or when carrying out other method, the field object proxy server is directly carried out the corresponding method of this field object by the method name.
Step 206, the described change class operational approach of execution are specially, and call field object proxy server that generates in advance and the field object buffer of the field object that changes in the described operational approach being put into correspondence;
In simple terms, when newly-built field object, by the building method of field object proxy server execution field object, the field object that will newly create carries out buffer memory then; And/or, when upgrading field object, carry out field object respective attributes method to set up by the field object proxy server, then this field object is carried out buffer memory; And/or, when the user deletes field object, carry out this field object method of deletion by the field object proxy server, then this field object is carried out buffer memory then.
A kind of example as concrete application, when newly-built field object, the field object proxy server knows that the building method that needs to carry out institute's Agent Domain object comes new Object, so carry out the building method of this field object, the field object that will newly create joins in the newly-built field object buffer then.
When upgrading field object, the field object proxy server is by the method name of " set " beginning, know that needing to carry out institute's Agent Domain object respective attributes method to set up comes this field object is upgraded, then carry out the respective attributes method to set up of this field object earlier, then this field object is joined and upgrade in the field object buffer, if upgrade a copy of existing this object in the field object buffer, then upgrading this copy with this field object property value, is up-to-date with the property value that guarantees this field object in the renewal field object buffer.
When the deletion field object, need earlier this field object of cleaning with the dependence of other field objects and by dependence, make this field object become isolated object, explicitly is carried out destroy () method then, after its field object proxy server is seen the method name, know the operation that needs to carry out this field object of deletion, then this field object is joined in the deletion field object buffer.
For change class operational approach, the field object of change can be put into three buffers respectively by the field object proxy server, changes step 207 then.
Step 207, after carrying out the current business method, judge and whether have only an element in the described operational approach call stack, if then execution in step 209; Otherwise, execution in step 208;
If have only an element in the call stack, illustrate that the current business method is positioned at the actuating logic outermost layer, after this operational approach is called end, can carry out issued transaction; If an above element is arranged in the call stack, representation program does not also turn back to the actuating logic outermost layer, need not carry out the issued transaction operation, directly calling service stack stack top element is popped.
Step 208, this operational approach is popped from described operational approach call stack;
Step 209, judge described newly-built field object buffer, upgrade the field object buffer and whether deletion field object buffer all be sky; If then execution in step 216; If not, execution in step 210 then;
If this operational approach is the inquiry class methods, then the field object buffer all is empty, need not to carry out the issued transaction operation, directly closes issued transaction and gets final product; If this operational approach is the change class methods, then the field object buffer not all is empty, need carry out issued transaction, changes next step over to.
Whether the field object in step 210, the judgement deletion field object buffer is present in the newly-built field object buffer buffer; If exist, then execution in step 211; If do not exist, then execution in step 212;
Step 211, with this field object from described newly-built field object buffer, upgrade field object buffer and the deletion field object buffer and delete, change step 212;
For the field object in each deletion field object buffer, check whether it is present in the increase field object buffer, if exist, illustrate this field object be created after (centre may be updated again), also do not store in the database deleted again, need not in storing database into later on again with its deletion, so it is removed from these three buffers.
Step 212, according to increase the field object buffer, upgrade the field object buffer, the order of deletion field object buffer stores field object in the database or from database into successively and deletes;
Step 213, submission issued transaction;
Step 214, empty the field object buffer;
Step 215, empty described operational approach call stack;
Step 216, close issued transaction.
In specific implementation, no matter it adopts the nesting allocation mode for each operational approach still is the recursive call mode, all handling according to actuating logic shown in Figure 2.
Need to prove, in the present embodiment,, do not relate to the processing of affairs submission and rollback affairs for the operational approach of inquiry class.Use present embodiment, when certain operational approach need be carried out other operational approach and finishes more complicated service and handle, do not need to realize again operational approach, by the operational approach call stack that in the business object proxy server, is provided with, the just mutual execution of a plurality of operational approaches of energy simple realization.Certainly, the above-mentioned operational approach call stack that is provided with only is as a kind of example to determine that outermost layer calls professional method, and in specific implementation, it all is feasible that those skilled in the art adopt any method, call the mode of counter etc. as employing, the present invention does not limit this.
For making those skilled in the art understand the present invention better, below the detailed process that the present invention carries out operational approach by the business object proxy server is further specified by an object lesson.
With the store sales goods for example, suppose that the shop only sells a kind of goods Product, after goods was sold in the shop, stock inventory reduced, income income increase.
1, the business object of store sales goods is saleProduct, and three operational approaches are wherein arranged:
" bool reduceInventory (int quantity) ", this method is used for reducing tank farm stock;
" bool adjustIncome (double sum) ", this method is used for adjusting gross income;
" bool salingProduct (int quantity, double income) ", this method is used for carrying out sales process, and reduceInventory method and adjustIncome method are called by portion within it;
2, stock inventory is a field object, and volume residual attribute residue and the corresponding set and the get function of an integer arranged;
3, income income is a field object, and gross income attribute balance and the corresponding set and the get function of a data type arranged.
Use the embodiment of the invention, the business procedure that the user sells n spare goods and takes in m unit comprises the steps:
The first step, user obtain its business object proxy server saleProduct_Proxy by the business object proxy server factory of business object saleProduct, replace saleProduct to carry out selling operation method salingProduct (n by saleProduct_Proxy, m), the data structure that in saleProdt_Proxy, has the following overall situation to share: issued transaction object transaction; Newly-increased field object buffer newBuffer, renewal field object buffer updateBuffer, deletion field object buffer deleteBuffer; Operational approach call stack stack first-in last-out.
When initial, all there is not any element in three buffers and the operational approach call stack stack; At this moment, the state of issued transaction object, buffer and call stack is respectively:
Transaction: close;
NewBuffer, updateBuffer, deleteBuffer: sky;
Stack: sky.
Second step, saleProduct_Proxy find to carry out salingProduct (n, m) method just with this method pop down, and is judged among the stack and is had only an element, know that current method is the operational approach that the outermost layer of this business processing calls, so open issued transaction.At this moment, the state of issued transaction object, buffer and call stack is respectively::
Transaction: open;
NewBuffer, updateBuffer, deleteBuffer: sky;
stack:salingProduct。
The 3rd step, SaleProduct_Proxy begin on behalf of salingProduct (n, m) method of carrying out SaleProduct.(n, m) reduceInventory (n) has successively called to salingProduct in portion within it, and adjustIncome (m) method.
A) at first salingProduct (n, m) reduceInventory (n) calls in portion within it, revises the surplus residue of stock inventory.When carrying out reduceInventory (n) operational approach, need this method pop down, at this moment, the state of issued transaction object, buffer and call stack is respectively::
Transaction: open;
NewBuffer, updateBuffer, deleteBuffer: sky;
stack:
reduceInventory
salingProduct
SaleProduct_Proxy finds that there are two elements in call stack, knows that just current method is not outermost operational approach, but by other method call, need not repeat to open issued transaction object transaction.
ReduceInventory (n) portion within it calls setResidue (n) method of inventory, and the internal logic of this set method is after doing necessary verification, deducts sales volume n with inventory balance.Because setResidue (n) method is the method for field object, so not with its pop down.This moment, saleProduct_Proxy was not setResidue (n) method of directly carrying out inventory yet, and by the field object proxy server inventory_Proxy that the field object proxy server factory of inventory obtains this field object, come on behalf of carrying out setResidue (n) method by inventory_Proxy.
It is to do change to its agency's field object inventory that inventory_Proxy finds, the issued transaction transation that this field object utilization is opened extracts it from database, and this field object put into upgrade field object buffer updateBuffer, carry out setResidue (n) then, its residue attribute is changed, just revise stockpile number.At this moment, the state of issued transaction object, buffer and call stack is respectively:
Transaction: open;
NewBuffer, deleteBuffer: sky;
updateBuffer:
inventory
stack:
reduceInventory
salingProduct
Then, actuating logic withdraws from reduceInventory (n) method, this method is popped, at this moment: transaction: open;
NewBuffer, deleteBuffer: sky;
updateBuffer:
inventory
stack:
salingProduct
B) then salingProduct (n, m) adjustIncome (m) calls in portion within it, revises the total value balance attribute of income income.When carrying out adjustIncome (m) operational approach, need with this method pop down, at this moment:
Transaction: open;
NewBuffer, updateBuffer, deleteBuffer: sky;
stack:
adjustIncome
salingProduct
SaleProduct_Proxy finds that there are two elements in call stack, knows that just current method is not outermost operational approach, but by other method call, need not repeat to open issued transaction transaction.
AdjustIncome (m) portion within it calls setBalance (m) method of income, and the internal logic of this set method is after doing necessary verification, adds this sales revenue m with the existing total amount of taking in.Because setBalance (m) method is the method for field object, so not with its pop down.This moment, saleProduct_Proxy was not setBalance (m) method of directly carrying out income yet, and by the field object proxy server income_Proxy that the field object proxy server factory of income obtains this field object, come on behalf of carrying out setBalance (m) method by income_Proxy.
Income_Proxy finds it is to do change to device agency's field object income, the issued transaction transation that this field object utilization is opened extracts it from database, and this field object put into upgrade field object buffer updateBuffer, carry out setBalance (m) then, its Balance attribute is changed, just revise the income sum.At this moment, the state of shared issued transaction object, buffer and call stack of the overall situation is respectively:
Transaction: open;
NewBuffer, deleteBuffer: sky;
updateBuffer:
inventory
income
stack:
adjustIncome
salingProduct
Then, actuating logic withdraws from adjustIncome (m) method, and this method is popped, and at this moment, the state that the overall situation is shared issued transaction object, buffer and call stack is respectively:
Transaction: open;
NewBuffer, deleteBuffer: sky;
updateBuffer:
inventory
income
stack:
salingProduct
4, saleProduct_Proxy executes salingProduct (n m) after the method, checks call stack stack, finds to have only element itself, knows that salingProduct is the operational approach that outermost layer calls, and has carried out the business processing that is over.Simultaneously, saleProduct_Proxy finds that the salingProduct method of carrying out is the change class methods, so carry out issued transaction at buffer, inventory, the income field object of buffer memory among the updateBuffer are synchronized in the database, submit issued transaction to, close issued transaction then.And empty buffer, empty and transfer call stack (just salingProduct being popped in fact).At this moment, the state of issued transaction object, buffer and call stack is respectively:
Transaction: close;
NewBuffer, updateBuffer, deleteBuffer: sky;
Stack: sky.
In embodiments of the present invention, the field object proxy server can collect the field object that relates to change in this business processing in the buffer, so that focus on, the field object proxy server judges whether field object has been done alter operation according to performed method name, thereby removes the issued transaction logic in the definition of field object itself.The business object proxy server can be included the method for calling mutually that relates in this business processing in the issued transaction in, carry out affairs control by judging the operational approach that outermost layer calls, issued transaction and exception handling logic are realized in the business object proxy server, thereby remove issued transaction and exception handling logic in business objects.The business object proxy server is done corresponding processing before and after this method is carried out when the business object operational approach of being acted on behalf of on behalf of execution, as opening issued transaction, submit the field object in the buffer to, closes issued transaction and abnormality processing etc.Issued transaction and exception handling logic all in the business object proxy server, need not be embedded in each operational approach of business object.The business object proxy server will be regarded an integral body as on each business processing process logic, concentrate and carry out issued transaction and abnormality processing.
Need to prove, for method embodiment, for simple description, so it all is expressed as a series of combination of actions, but those skilled in the art should know, the application is not subjected to the restriction of described sequence of movement, because according to the application, some step can adopt other orders or carry out simultaneously.Secondly, those skilled in the art also should know, the embodiment described in the instructions all belongs to preferred embodiment, and related action and module might not be that the application is necessary.
With reference to figure 3, show the structured flowchart of a kind of operational approach actuating unit embodiment that handles based on db transaction of the present invention, in specific implementation, to generate business object proxy server 30 at newly-built business object, carry out the operational approach of described business object by described business object proxy server, described business object proxy server specifically can comprise with lower module:
Affairs opening module 301, be used for current pending operational approach be outermost layer call operational approach the time, be that this operational approach opens issued transaction, and empty the field object buffer that presets; Wherein, described operational approach comprises change class operational approach;
Operational approach execution module 302 is used to carry out described operational approach, and calls the field object proxy server that generates in advance the field object that changes in the described operational approach is put into corresponding field object buffer;
Issued transaction module 303, be used for carrying out issued transaction when described operational approach runs succeeded, described issued transaction comprises: the field object in the described field object buffer is stored in the database, and/or, the field object of appointment in the described field object buffer of deletion from database;
Affairs are submitted closing module 304 to, after being used to submit to issued transaction and emptying described field object buffer, close issued transaction.
In specific implementation, described business object proxy server can also comprise:
Transaction rollback closing module 305 is used for when described operational approach is carried out failure, the rollback issued transaction and empty described field object buffer after, close issued transaction.
A kind of preferred exemplary that realizes as the embodiment of the invention is provided with operational approach call stack first-in last-out in can described business object proxy server, and described business object proxy server can also comprise with lower module:
The call stack judge module is used for before carrying out the current business method, judges whether described operational approach call stack is empty, if empty, determines that then the current business method is the operational approach that outermost layer calls;
The first pop down module is used for after opening issued transaction the current business method being pressed into described operational approach call stack.
The second pop down module, it is not empty being used at described operational approach call stack, when not opening issued transaction, directly the current business method is pressed into described operational approach call stack.
More preferably, described business object proxy server can also comprise with lower module:
Outermost layer method verification module is used for judging whether have only an element in the described operational approach call stack after carrying out the current business method, if then after submitting issued transaction to, trigger call stack and empty module; If not, then trigger the module of popping;
Call stack empties module, is used to empty described operational approach call stack;
The module of popping is used for directly this operational approach being popped from described operational approach call stack.
In specific implementation, the described field object buffer that presets can comprise newly-built field object buffer, upgrade field object buffer and deletion field object buffer, and in this case, described field object proxy server specifically can comprise with lower module:
The newly-built module of field object is used for newly-built field object, and newly-built field object is put into described newly-built field object buffer;
And/or,
The field object update module is used to upgrade field object, and the field object that upgrades is put into described renewal field object buffer, and the field object of described renewal has corresponding property value;
And/or,
The field object removing module is used for the field object of deletion is put into described deletion field object buffer;
Described issued transaction module specifically can comprise following submodule:
Database writes submodule, is used for the field object of newly-built field object buffer, renewal field object buffer is stored in the database;
And/or,
Database deletion submodule is used for the field object from the described deletion field object buffer of database deletion.
More preferably, described issued transaction module can also comprise following submodule:
The database manipulation submodule, be used for according to increase the field object buffer, upgrade the field object buffer, the order of deletion field object buffer stores field object into database successively or deletes from database,
More preferably, described business object proxy server can also comprise with lower module:
The buffer memory judge module is used for before carrying out issued transaction, and whether judge described newly-built field object buffer, upgrade the field object buffer and delete the field object buffer all is empty; If not, then trigger the buffer memory adjusting module;
The buffer memory adjusting module is used for the field object at deletion field object buffer, when being present in newly-built field object buffer, with this field object from described newly-built field object buffer, upgrade field object buffer and the deletion field object buffer and delete.
In specific implementation, described operational approach can also comprise inquiry class operational approach, and in this case, described field object proxy server can also comprise the field object enquiry module, and described field object enquiry module is used to carry out the correlation method to the specified domain object; Described operational approach execution module also comprises following submodule:
Directly implementation sub-module is used to carry out operational approach, and calls the field object enquiry module of described field object proxy server;
Described business object proxy server also comprises with lower module:
The affairs closing module is used at described newly-built field object buffer, upgrades the field object buffer and delete the field object buffer when all being sky, directly closes issued transaction.
Because present embodiment is substantially corresponding to aforementioned method embodiment illustrated in figures 1 and 2, so not detailed part in the description of present embodiment can just not given unnecessary details at this referring to the related description in the previous embodiment.
The present invention can be used in numerous general or special purpose calculation element environment or the configuration.For example: multiprocessor device, server, network PC, small-size computer, mainframe computer, comprise distributed computing environment of above any device or equipment or the like.
The present invention can describe in the general context of the computer executable instructions of being carried out by computing machine, for example program module.Usually, program module comprises the routine carrying out particular task or realize particular abstract, program, object, assembly, data structure or the like.Also can in distributed computing environment, put into practice the present invention, in these distributed computing environment, by by communication network connected teleprocessing equipment execute the task.In distributed computing environment, program module can be arranged in the local and remote computer-readable storage medium that comprises memory device.
More than a kind of db transaction treating apparatus provided by the present invention is described in detail, used specific case herein principle of the present invention and embodiment are set forth, the explanation of above embodiment just is used for helping to understand method of the present invention and core concept thereof; Simultaneously, for one of ordinary skill in the art, according to thought of the present invention, the part that all can change in specific embodiments and applications, in sum, this description should not be construed as limitation of the present invention.

Claims (18)

1. an operational approach manner of execution of handling based on db transaction is characterized in that, comprising:
Generate corresponding service object broker device at newly-built business object, when carrying out the operational approach of described business object, carry out following treatment step by described business object proxy server:
Current pending operational approach be outermost layer call operational approach the time, be that this operational approach opens issued transaction, and empty the field object buffer that presets; Wherein, described operational approach comprises change class operational approach;
Carry out described operational approach, and call the field object proxy server that generates in advance the field object that changes in the described operational approach is put into corresponding field object buffer;
When described operational approach runs succeeded, carry out issued transaction, described issued transaction comprises: the field object in the described field object buffer stored in the database, and/or, the field object of appointment in the described field object buffer of deletion from database;
After submitting issued transaction to and emptying described field object buffer, close issued transaction.
2. the method for claim 1 is characterized in that, also comprises:
When described operational approach is carried out failure, the rollback issued transaction and empty described field object buffer after, close issued transaction.
3. method as claimed in claim 1 or 2 is characterized in that, is provided with operational approach call stack first-in last-out in the described business object proxy server, and described method also comprises:
Before carrying out the current business method, judge whether described operational approach call stack is empty, if empty, determine that then the current business method is the operational approach that outermost layer calls;
After opening issued transaction, the current business method is pressed into described operational approach call stack.
4. method as claimed in claim 3 is characterized in that, also comprises:
If described operational approach call stack is not empty, then do not open issued transaction, directly the current business method is pressed into described operational approach call stack.
5. as claim 3 or 4 described methods, it is characterized in that, also comprise:
After carrying out the current business method, judge whether have only an element in the described operational approach call stack, if then after submitting issued transaction to, empty described operational approach call stack;
If not, then directly this operational approach is popped from described operational approach call stack.
6. the method for claim 1, it is characterized in that, the described field object buffer that presets comprises newly-built field object buffer, upgrades field object buffer and deletion field object buffer, and the step that the described field object proxy server that calls generation is in advance put into corresponding field object buffer with the field object that changes in the operational approach comprises:
By the newly-built field object of field object proxy server that generates in advance, and newly-built field object put into described newly-built field object buffer;
And/or,
Upgrade field object by the field object proxy server that generates in advance, and the field object that upgrades is put into described renewal field object buffer, the field object of described renewal has corresponding property value;
And/or,
By the field object proxy server that generates in advance the field object of deletion is put into described deletion field object buffer;
The described step that field object in the field object buffer is stored in the database is that the field object in newly-built field object buffer, the renewal field object buffer is stored in the database;
Described step of deleting the field object of appointment in the field object buffer from database is the field object from database in the described deletion field object buffer of deletion.
7. method as claimed in claim 6 is characterized in that, described issued transaction also comprises:
According to increase the field object buffer, upgrade the field object buffer, the order of deletion field object buffer stores field object in the database or from database into successively and deletes.
8. method as claimed in claim 7 is characterized in that, before carrying out issued transaction, also comprises:
Whether judge described newly-built field object buffer, upgrade the field object buffer and delete the field object buffer all is empty;
If not, then judge the field object in the deletion field object buffer, whether be present in the newly-built field object buffer;
If exist, then this field object is deleted from described newly-built field object buffer, renewal field object buffer and deletion field object buffer.
9. method as claimed in claim 8 is characterized in that, described operational approach also comprises inquiry class operational approach, and the step of described execution operational approach also comprises:
Call the field object proxy server that generates in advance, directly carry out correlation method the specified domain object;
Described method also comprises:
When described newly-built field object buffer, renewal field object buffer and deletion field object buffer all are sky, directly close issued transaction.
10. an operational approach actuating unit of handling based on db transaction is characterized in that, comprising:
The business object proxy server generates at newly-built business object, is used to carry out the operational approach of described business object, specifically comprises with lower module:
The affairs opening module, be used for current pending operational approach be outermost layer call operational approach the time, be that this operational approach opens issued transaction, and empty the field object buffer that presets; Wherein, described operational approach comprises change class operational approach;
The operational approach execution module is used to carry out described operational approach, and calls the field object proxy server that generates in advance the field object that changes in the described operational approach is put into corresponding field object buffer;
The issued transaction module, be used for carrying out issued transaction when described operational approach runs succeeded, described issued transaction comprises: the field object in the described field object buffer is stored in the database, and/or, the field object of appointment in the described field object buffer of deletion from database;
Affairs are submitted closing module to, after being used to submit to issued transaction and emptying described field object buffer, close issued transaction.
11. device as claimed in claim 10 is characterized in that, described business object proxy server also comprises:
The transaction rollback closing module is used for when described operational approach is carried out failure, the rollback issued transaction and empty described field object buffer after, close issued transaction.
12., it is characterized in that be provided with operational approach call stack first-in last-out in the described business object proxy server, described business object proxy server also comprises as claim 10 or 11 described devices:
The call stack judge module is used for before carrying out the current business method, judges whether described operational approach call stack is empty, if empty, determines that then the current business method is the operational approach that outermost layer calls;
The first pop down module is used for after opening issued transaction the current business method being pressed into described operational approach call stack.
13. device as claimed in claim 12 is characterized in that, described business object proxy server also comprises:
The second pop down module, it is not empty being used at described operational approach call stack, when not opening issued transaction, directly the current business method is pressed into described operational approach call stack.
14. device as claimed in claim 13 is characterized in that, described business object proxy server also comprises:
Outermost layer method verification module is used for judging whether have only an element in the described operational approach call stack after carrying out the current business method, if then after submitting issued transaction to, trigger call stack and empty module; If not, then trigger the module of popping;
Call stack empties module, is used to empty described operational approach call stack;
The module of popping is used for directly this operational approach being popped from described operational approach call stack.
15. device as claimed in claim 10 is characterized in that, the described field object buffer that presets comprises newly-built field object buffer, upgrades field object buffer and deletion field object buffer, and described field object proxy server specifically comprises:
The newly-built module of field object is used for newly-built field object, and newly-built field object is put into described newly-built field object buffer;
And/or,
The field object update module is used to upgrade field object, and the field object that upgrades is put into described renewal field object buffer, and the field object of described renewal has corresponding property value;
And/or,
The field object removing module is used for the field object of deletion is put into described deletion field object buffer;
Described issued transaction module specifically comprises:
Database writes submodule, is used for the field object of newly-built field object buffer, renewal field object buffer is stored in the database;
And/or,
Database deletion submodule is used for the field object from the described deletion field object buffer of database deletion.
16. device as claimed in claim 15 is characterized in that, described issued transaction module also comprises:
The database manipulation submodule, be used for according to increase the field object buffer, upgrade the field object buffer, the order of deletion field object buffer stores field object into database successively or deletes from database.
17. device as claimed in claim 16 is characterized in that, described business object proxy server also comprises:
The buffer memory judge module is used for before carrying out issued transaction, and whether judge described newly-built field object buffer, upgrade the field object buffer and delete the field object buffer all is empty; If not, then trigger the buffer memory adjusting module;
The buffer memory adjusting module is used for the field object at deletion field object buffer, when being present in the newly-built field object buffer, this field object is deleted from described newly-built field object buffer, renewal field object buffer and deletion field object buffer.
18. device as claimed in claim 17 is characterized in that, described operational approach also comprises inquiry class operational approach, and described field object proxy server also comprises the field object enquiry module, and described field object enquiry module is used to carry out the correlation method to the specified domain object; Described operational approach execution module also comprises:
Directly implementation sub-module is used to carry out operational approach, and calls the field object enquiry module of described field object proxy server;
Described business object proxy server also comprises:
The affairs closing module is used at described newly-built field object buffer, upgrades the field object buffer and delete the field object buffer when all being sky, directly closes issued transaction.
CN 201110090410 2011-04-11 2011-04-11 Implementation method and device of business method based on database transaction Expired - Fee Related CN102156735B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN 201110090410 CN102156735B (en) 2011-04-11 2011-04-11 Implementation method and device of business method based on database transaction

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN 201110090410 CN102156735B (en) 2011-04-11 2011-04-11 Implementation method and device of business method based on database transaction

Publications (2)

Publication Number Publication Date
CN102156735A true CN102156735A (en) 2011-08-17
CN102156735B CN102156735B (en) 2012-12-26

Family

ID=44438234

Family Applications (1)

Application Number Title Priority Date Filing Date
CN 201110090410 Expired - Fee Related CN102156735B (en) 2011-04-11 2011-04-11 Implementation method and device of business method based on database transaction

Country Status (1)

Country Link
CN (1) CN102156735B (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102354289A (en) * 2011-09-21 2012-02-15 苏州大学 Concurrent transaction scheduling method and related device
CN103593174A (en) * 2012-08-13 2014-02-19 Sap股份公司 Adaptable business object
CN104268767A (en) * 2014-10-22 2015-01-07 中国建设银行股份有限公司 Core service object consistency processing method and core service object agency
WO2016065904A1 (en) * 2014-10-29 2016-05-06 中兴通讯股份有限公司 Database processing method, device and system
WO2020199709A1 (en) * 2019-04-04 2020-10-08 创新先进技术有限公司 Method and system for refershing cascaded cache, and device
US10922236B2 (en) 2019-04-04 2021-02-16 Advanced New Technologies Co., Ltd. Cascade cache refreshing

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1955992A (en) * 2005-10-26 2007-05-02 北京航空航天大学 Method of operating web service working flow based on stack mode
US20080235292A1 (en) * 2005-10-03 2008-09-25 Amadeus S.A.S. System and Method to Maintain Coherence of Cache Contents in a Multi-Tier System Aimed at Interfacing Large Databases
CN101777154A (en) * 2010-02-01 2010-07-14 浪潮集团山东通用软件有限公司 Persistence method of workflow data in workflow management system

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080235292A1 (en) * 2005-10-03 2008-09-25 Amadeus S.A.S. System and Method to Maintain Coherence of Cache Contents in a Multi-Tier System Aimed at Interfacing Large Databases
CN1955992A (en) * 2005-10-26 2007-05-02 北京航空航天大学 Method of operating web service working flow based on stack mode
CN101777154A (en) * 2010-02-01 2010-07-14 浪潮集团山东通用软件有限公司 Persistence method of workflow data in workflow management system

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102354289A (en) * 2011-09-21 2012-02-15 苏州大学 Concurrent transaction scheduling method and related device
CN103593174A (en) * 2012-08-13 2014-02-19 Sap股份公司 Adaptable business object
CN103593174B (en) * 2012-08-13 2019-02-12 Sap欧洲公司 Method, system and computer-readable medium for revisable business object
CN104268767A (en) * 2014-10-22 2015-01-07 中国建设银行股份有限公司 Core service object consistency processing method and core service object agency
WO2016065904A1 (en) * 2014-10-29 2016-05-06 中兴通讯股份有限公司 Database processing method, device and system
WO2020199709A1 (en) * 2019-04-04 2020-10-08 创新先进技术有限公司 Method and system for refershing cascaded cache, and device
US10922236B2 (en) 2019-04-04 2021-02-16 Advanced New Technologies Co., Ltd. Cascade cache refreshing

Also Published As

Publication number Publication date
CN102156735B (en) 2012-12-26

Similar Documents

Publication Publication Date Title
CN102016842B (en) Improvements relating to handling and processing of massive numbers of processing instructions in real time
US7103597B2 (en) Adaptive transaction manager for complex transactions and business process
CN102156735B (en) Implementation method and device of business method based on database transaction
Greenfield et al. Compensation is not enough [fault-handling and compensation mechanism]
US7487512B2 (en) Publish-subscribe event notifications
US6009405A (en) Ensuring atomicity for a collection of transactional work items in a workflow management system
CN100594498C (en) Mass data real time processing structure and real time need-based processing platform used for the structure
JP4571636B2 (en) Service management of service-oriented business framework
CN104793988A (en) Cross-database distributed transaction implementation method and device
KR20080106561A (en) Abstract execution model for a continuation-based meta-runtime
CN100432997C (en) Extending service-oriented business frameworks
AU2009212935B2 (en) Method and apparatus for facilitating a persistence application programming interface
US20190007489A1 (en) System and Methods for Running a Condition-Triggered Process Involving Movement of Objects from a Node to at least one other Node Until a Condition with a Set of Parameters Are Met By An Event
JP3732113B2 (en) Transaction control system, method and program
Papazoglou et al. Configurable business objects for building evolving enterprise models and applications
Papazoglou et al. Distributed, interoperable workflow support for electronic commerce
Alonso et al. Processes in electronic commerce
Bravetti et al. Service oriented computing from a process algebraic perspective
Böhm et al. Demaq: A foundation for declarative XML message processing
van den Heuvel et al. Configuring business objects from legacy systems
EP0831398B1 (en) Ensuring atomicity for a collection of transactional workitems in a workflow-management-system
Su et al. Yank your data out of my engine: A new approach to workflow system design
EP2601627B1 (en) Transaction processing system and method
US20060294006A1 (en) Business transaction process controller for composite transactions
Krishna et al. A methodology for evolving e-contracts using templates

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20121226

Termination date: 20160411

CF01 Termination of patent right due to non-payment of annual fee