CN107967328B - Method for solving hibernate incompatibility caused by Hessian - Google Patents

Method for solving hibernate incompatibility caused by Hessian Download PDF

Info

Publication number
CN107967328B
CN107967328B CN201711194169.5A CN201711194169A CN107967328B CN 107967328 B CN107967328 B CN 107967328B CN 201711194169 A CN201711194169 A CN 201711194169A CN 107967328 B CN107967328 B CN 107967328B
Authority
CN
China
Prior art keywords
hessian
hibernate
judging whether
class
solving
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201711194169.5A
Other languages
Chinese (zh)
Other versions
CN107967328A (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.)
Sichuan Changhong Electric Co Ltd
Original Assignee
Sichuan Changhong Electric 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 Sichuan Changhong Electric Co Ltd filed Critical Sichuan Changhong Electric Co Ltd
Priority to CN201711194169.5A priority Critical patent/CN107967328B/en
Publication of CN107967328A publication Critical patent/CN107967328A/en
Application granted granted Critical
Publication of CN107967328B publication Critical patent/CN107967328B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2453Query optimisation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2458Special types of queries, e.g. statistical queries, fuzzy queries or distributed queries
    • G06F16/2471Distributed queries

Abstract

The invention discloses a method for solving hibernate incompatibility caused by Hessian, which comprises the following steps: an object is transmitted and filtered; judging whether the object in the step 1 is a conventional object or not, and if the object is the conventional object, not traversing; judging whether the object belongs to a set object, if so, traversing the set content of the object, and then recursing; during recursion, whether dead circulation exists needs to be judged; judging whether the filtering class is entity.class in a specific filtering class, and if so, replacing the collection elements in the class; and replacing the content in the set, and after the content is replaced, the hessian cannot report an error. The method solves the problem of abnormal session closing caused by the fact that the corresponding relation of @ OneToMany in hibernate exceeds 7 in Hessian serialization, and is easy to use and stable in performance.

Description

Method for solving hibernate incompatibility caused by Hessian
Technical Field
The invention relates to the technical field of distributed cloud computing platforms, in particular to a method for solving hibernate incompatibility caused by Hessian, which uses a DUBBO framework to realize the aspect of distribution.
Background
Hessian is a lightweight remoting onhttp tool that provides RMI functionality using a simple method. Compared with WebService, Hessian is simpler and quicker. The binary RPC protocol is used, and is well suited for transmitting binary data because it is a binary protocol.
Hibernate is an object relation mapping framework of open source code, which encapsulates JDBC with very light weight objects, establishes a mapping relation between POJO and a database table, is a fully automatic orm framework, and can automatically generate SQL statements and automatically execute, so that Java programmers can use object programming thinking to manipulate the database at will. Hibernate can be applied to any occasions using JDBC, can be used in Java client programs and can also be used in Servlet/JSP Web applications, and has the revolutionary significance that Hibernate can replace CMP in the J2EE architecture applying EJB to complete the re-mission of data persistence.
Disclosure of Invention
The invention overcomes the defects of the prior art, provides a method for solving the incompatibility problem of hibernate caused by Hessian, and is used for solving the technical problem of session abnormity caused by the fact that the corresponding relation of @ OneToMany in hibernate exceeds 7 in Hessian serialization.
In view of the above problems of the prior art, according to one aspect of the present disclosure, the following technical solutions are adopted in the present invention:
a method of resolving hibernate incompatibility resulting from Hessian, comprising:
step 1: an object is transmitted and filtered;
step 2: judging whether the object in the step 1 is a conventional object or not, and if the object is the conventional object, not traversing;
and step 3: judging whether the object belongs to a set object, if so, traversing the set content of the object, and then recursing;
and 4, step 4: during recursion, judging whether dead circulation exists or not, and if the dead circulation exists and the dead circulation exceeds a certain number of times, the circulation is invalid;
and 5: judging whether the filtering class is entity.class in a specific filtering class, and if so, replacing the collection elements in the class;
step 6: and replacing the content in the set, and after the content is replaced, the hessian cannot report an error.
In order to better realize the invention, the further technical scheme is as follows:
according to an embodiment of the present invention, in the case that the object in step 2 is String, Integer, no traversal is needed.
According to another embodiment of the present invention, in the step 4, in case the number of dead cycles exceeds 9, the cycle is failed.
Compared with the prior art, the invention has the following beneficial effects:
the method for solving the incompatibility problem of hibernate caused by Hessian solves the problem that session closing is abnormal caused by the fact that the corresponding relation of @ OneToMany in hibernate exceeds 7 when Hessian is serialized; the invention has the application range of the place using hessian serialization in the distributed environment, and is suitable for the dubbo cluster; the device is convenient for developers, easy to use and stable in performance.
Drawings
For a clearer explanation of the embodiments or technical solutions in the prior art of the present application, the drawings used in the description of the embodiments or prior art will be briefly described below, it is obvious that the drawings in the following description are only references to some embodiments in the present application, and other drawings can be obtained by those skilled in the art without creative efforts.
FIG. 1 is a block flow diagram according to one embodiment of the invention.
Detailed Description
The present invention will be described in further detail with reference to examples, but the embodiments of the present invention are not limited thereto.
As shown in fig. 1, fig. 1 is a flow chart according to an embodiment of the present invention, and a method for solving hibernate incompatibility caused by Hessian is a solution proposed for session abnormal shutdown caused by @ onetomay correspondence exceeding 7 in hibernate during Hessian serialization. For example, in an Entity object @ Entity, if the annotation @ OneToMany has more than 7 relationships. Then over the 7-entry segment, Hessian serialization would page it. But at the time of the second request, the hibernate session has been closed, so compatibility issues arise. Aiming at the compatibility problem, the invention replaces the proxy class realized by hibernate with the common set class. The method comprises the following specific steps:
the method comprises the following steps: passing an object into a filtering means;
step two: it is judged whether the method is a normal one. These classes, such as String Integer, do not need to be traversed;
step three: judging whether the object belongs to a set object, if so, traversing the set content of the object, and then recursing;
step four: during recursion, whether dead cycles exist needs to be judged, and if the dead cycles exceed 9 times, the cycles fail;
step five: class is judged whether to be entity in a specific filtering class, and if so, the collection elements in the class need to be replaced. (ii) a
Step six: replacing the content within the collection. After replacing the content, the hessian will not report an error.
In conclusion, the method for solving the incompatibility problem of hibernate caused by Hessian solves the problem of abnormal session closing caused by the fact that the corresponding relation of @ OneToMany in hibernate exceeds 7 when Hessian is serialized; the invention has the application range of the place using hessian serialization in the distributed environment, and is suitable for the dubbo cluster; the device is convenient for developers, easy to use and stable in performance.
Reference throughout this specification to "one embodiment," "another embodiment," "an embodiment," etc., means that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one embodiment described generally in this application. The appearances of the same phrase in various places in the specification are not necessarily all referring to the same embodiment. Further, when a particular feature, structure, or characteristic is described in connection with any embodiment, it is submitted that it is within the scope of the invention to effect such feature, structure, or characteristic in connection with other embodiments.
Although the invention has been described herein with reference to a number of illustrative embodiments thereof, it should be understood that numerous other modifications and embodiments can be devised by those skilled in the art that will fall within the spirit and scope of the principles of this disclosure. More specifically, various variations and modifications are possible in the component parts and/or arrangements of the subject combination arrangement within the scope of the disclosure and claims of this application. In addition to variations and modifications in the component parts and/or arrangements, other uses will also be apparent to those skilled in the art.

Claims (1)

1. A method for solving hibernate incompatibility caused by Hessian is characterized by comprising the following steps:
step 1: introducing a hessian object into a judgment rule and filtering, wherein the judgment rule is as follows: judging that the hessian object value is not null and the execution times is less than 9, if the hessian object value meets the judgment rule, adding 1 to the execution times, and entering the step 2; if the judgment rule is not satisfied, the processing is finished;
step 2: judging whether the hessian object type in the step 1 belongs to a String or Integer type, if so, ending the processing; otherwise, entering step 3;
and step 3: judging whether the hessian object type in the step 1 belongs to a set type, if so, traversing the hessian object value, and executing the step 1 again on the hessian object value obtained by traversal, otherwise, entering the step 4;
and 4, step 4: judging whether the hessian object is a hibernate entity class, if so, entering step 5;
and 5: replacing the hessian object with a List type or a Set type.
CN201711194169.5A 2017-11-24 2017-11-24 Method for solving hibernate incompatibility caused by Hessian Active CN107967328B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711194169.5A CN107967328B (en) 2017-11-24 2017-11-24 Method for solving hibernate incompatibility caused by Hessian

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711194169.5A CN107967328B (en) 2017-11-24 2017-11-24 Method for solving hibernate incompatibility caused by Hessian

Publications (2)

Publication Number Publication Date
CN107967328A CN107967328A (en) 2018-04-27
CN107967328B true CN107967328B (en) 2021-04-02

Family

ID=61997716

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711194169.5A Active CN107967328B (en) 2017-11-24 2017-11-24 Method for solving hibernate incompatibility caused by Hessian

Country Status (1)

Country Link
CN (1) CN107967328B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102096584A (en) * 2009-12-15 2011-06-15 阿里巴巴集团控股有限公司 Method, equipment and system for modifying time stamp on page script
CN106933564A (en) * 2015-12-31 2017-07-07 远光软件股份有限公司 The querying method that ECP platform datas are accessed is realized by Fitler models and note extension

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
AU2014318585B2 (en) * 2013-09-12 2018-01-04 Virsec Systems, Inc. Automated runtime detection of malware

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102096584A (en) * 2009-12-15 2011-06-15 阿里巴巴集团控股有限公司 Method, equipment and system for modifying time stamp on page script
CN106933564A (en) * 2015-12-31 2017-07-07 远光软件股份有限公司 The querying method that ECP platform datas are accessed is realized by Fitler models and note extension

Also Published As

Publication number Publication date
CN107967328A (en) 2018-04-27

Similar Documents

Publication Publication Date Title
JP5551939B2 (en) Method, computer-readable medium, and system for generating parallel SIMD code for any target architecture
WO2018072493A1 (en) Compiling method and compiling system
US10922214B1 (en) System and method for implementing a test optimization module
US10310828B2 (en) System and method for providing and executing a domain-specific language for cloud services infrastructure
EP3660684A1 (en) Efficient and comprehensive source code fuzzing
US10176273B2 (en) Big data parser
US20190196936A1 (en) Conditional wrapper for program object
US9563650B2 (en) Migrating federated data to multi-source universe database environment
US20110106853A1 (en) Declarative model security pattern
DE102012210420A1 (en) A native program procedure for applying the same transaction context when invoked by the primary program running in a separate environment
US20160132308A1 (en) Leveraging legacy applications for use with modern applications
US20140331201A1 (en) Optimizing intermediate representation of script code for fast path execution
US20140068573A1 (en) Error-code and exception-based function dispatch tables
US20160070637A1 (en) Documents for human readable documentation and runtime validation
US11960495B2 (en) Providing access to state information associated with operators in a data processing system
CN105138646A (en) Database operation method based on Hibernate
US10558670B2 (en) Smart tuple condition-based operation performance
WO2021244088A1 (en) Program control method and apparatus, and computer device and storage medium
CN107967328B (en) Method for solving hibernate incompatibility caused by Hessian
WO2017019113A1 (en) Concurrency testing
Papoulias Remote Debugging and Reflection in Resource Constrained Devices
US20140372488A1 (en) Generating database processes from process models
US20200159641A1 (en) Debugging asynchronous functions
US10558640B2 (en) Dynamically adding custom data definition language syntax to a database management system
US11928169B2 (en) System and method for implementing a functional documentation module

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