Comparative analysis of the efficiency of DataPersistence Frameworks. Case study Hibernate5.4 and MyBatis 3.4Abstract. - The objective of the study was to determine whether Hibernate 5.4 or MyBatis 3.4 is the mostefficient in terms of time, RAM, and CPU usage. Two REST microservices were implemented to perform CRUDoperations; which were accessed by REST services developed with Hibernate and MyBatis invoked from aclient. Our results were that Hibernate was the most efficient with respect to processing time at 509.1% and47.7% for select and delete queries, while Mybatis was at 12.7% and 14.2% for update and insert queries,correspondingly. Regarding the use of RAM and CPU, MyBatis was determined to be the most efficient at55.2% and 20% respectively.Keywords: Data persistence framework, comparative analysis, Hibernate, MyBatis. ISSN-E: 2542-3401, ISSN-P: 1316-4821Universidad, Ciencia y Tecnología, Vol. 26, Núm. 117, (pp. 24-32)Medoza-Palomino et al. Comparative analysis of the efficiency of Data Persistence Frameworks. Case study Hibernate 5.4 and MyBatis 3.4Yolvis Luis Mendoza-Palominohttps://orcid.org/0000-0002-6948-5558yolvis.mendoza.27@unsch.edu.peQualifactsLima, PerúResumen. - El objetivo del estudio fue determinar si Hibernate 5.4 o MyBatis 3.4 es el más eficiente enreferencia al uso del tiempo, la RAM y la CPU. Se implementó dos microservicios REST para realizaroperaciones CRUD; los cuales fueron accedidos por servicios REST desarrollados con Hibernate y MyBatisinvocados desde un cliente. Nuestros resultados fueron que Hibernate fue el más eficiente respecto al tiempode procesamiento en un 509.1% y 47.7% para consultas de selección y eliminación, mientras que Mybatis enun 12.7% y 14.2% para consultas de actualización e inserción, correspondientemente. Con respecto al uso dela RAM y la CPU se determinó que MyBatis fue el más eficiente en un 55.2% y 20% respectivamente.Palabras clave: Framework de persistencia de datos, análisis comparativo, Hibernate, MyBatis.Análisis comparativo de la eficiencia de Frameworks de persistencia de datos, casode estudio Hibernate 5.4 y MyBatis 3.424Recibido (29/07/2022), Aceptado (01/10/2022)Manuel Avelino Lagos-Barzolahttps://orcid.org/0000-0001-8078-755Xmanuel.lagos@unsch.edu.peUniversidad Nacional de San Cristóbal de HuamangaAyacucho, PerúEfraín Elías Porras Floreshttps://orcid.org/0000-0002-5560-0308efrain.porras@unsch.edu.peUniversidad Nacional de San Cristóbal de HuamangaAyacucho, Perúhttps://doi.org/10.47460/uct.v26i117.657
I. INTRODUCTION Given the wide variety of data persistence frameworks, usually software developers faced the dilemma ofwhich framework to use in order to achieve their objectives in terms of software implementation, the shortesttime, and the highest quality. The study in [1] highlights and describes that the object-relational mapping(ORM) solution is available in many popular platforms, that offer useful tools allowing developers to beconcerned about other pending issues. The work in [2] indicates that among of the most relevant aspects when choosing a framework are speed andefficiency, which may have many issues due to the diversity of metrics to measure the performance of aframework. However, there are other aspects that could help to decide, such as the response speed, theintegration with the database, the use of the CPU, and the use of RAM. The study [3], concerned about data processing time, reported that the Hibernate framework slightlyincreases the processing times when compared to the MyBatis framework, in an experimentation queryautomatically generated and variation of caching algorithms. Similarly, the work in [4] compared Hibernateagainst MyBatis, concluding that Hibernate outperforms MyBatis in terms of available documentation, quality,robustness, and easy learning curve, which makes it ideal for developing software projects. Because the Hibernate and MyBatis frameworks are widely used by software developers in Java languageprogramming; it is desirable to carry out an evaluation of the efficiency of both frameworks aiming to establishwhich could be selected as a framework for a software development project. Although previous studies triedto establish which is the best one, there is a lack of a deep study in terms of time, RAM, and CPU usage. In thiswork, we provide a study to determine whether the Hibernate 5.4 and the MyBatis 3.4 frameworks is the bestone for software development. II. DEVELOPMENT A. Object-relational mapping The study [5] established that object-relational mapping (ORM) is a technique that allows converting systemdata used in an object-oriented programming language, into data used by a relational database. Thereby, ORMcreates a virtual object-oriented database over a relational one. Thus, allowing the use of object-orientedfeatures such as inheritance and polymorphism. The work [6] indicated that ORM refers to the automatic persistence of objects from a Java application totables in a relational database and that the mapping between the objects and the database is described inmetadata, which is used to reverse effects. Despite this advantage, a considerable aspect to take into accountabout the use of this technique is the compromise of the performance of applications. Another study from a developer perspective [7], concluded that ORM encompasses solutions for mappingbusiness objects to relational data, delegating to the persistence layer the details of its persistence. However,ORM is not fully automatic, and that automation is indescribable. B. Data persistence Data persistence can be understood as the maintenance of the state of the object as well as its class, notreducing it to any particular program [8]. In a more specific sense, data persistence is the ability of a computerto retain information even after shutting down or closing the program that uses that information [8],[9].25Medoza-Palomino et al. Comparative analysis of the efficiency of Data Persistence Frameworks. Case study Hibernate 5.4 and MyBatis 3.4ISSN-E: 2542-3401, ISSN-P: 1316-4821Universidad, Ciencia y Tecnología, Vol. 26, Núm. 117, (pp. 24-32)
C. Framework The term framework is used in many contexts [11], such as applications in medicine, computer vision, games,and among others, in which it is used to describe a software structure consisting of adaptable andinterchangeable components for developing applications. In other words, a framework can be thought of assomething incomplete, but configurable generic application by means of adding complements. D.Hibernate Hibernate is a framework that provides a complete solution to the problem of data persistence in Java. Byinteracting between the application and the relational database, Hibernate allows developers to focus on thebusiness problem. Hibernate also enables us to follow a lot of design rules and specific patterns when creatingpersistence classes and business logic. Moreover, Hibernate furnishes high integration with most new andexisting applications without the need to make major changes to other parts of the application [6]. Finally, theframework is an open-source Data Persistence Framework, easily combined with HQL and SQL software [12]. E. MyBatis Mybatis is another persistence framework that supports SQL, stored procedures, and, advanced mappings.MyBatis does not require JDBC code, manual parameter setting, and retrieval of results. MyBatis can beconfigured with XML, and annotations, and allows maps and POJOs (Plain Old Java Objects) to be mapped todatabase records [13],[14]. F. Efficiency Efficiency is defined as the characteristic that would allow evaluation of the relationship between the level ofperformance of software and the number of resources used. The aspects to be evaluated would be the timebehavior related to adequate response and processing times, that is to say, the performance when executingits function under specific conditions and, on the other hand, the resource behavior, related to the capacity ofthe software to use suitable amounts and types of resources, also operating under specific conditions [15]. G. Aspect-Oriented Programming The Aspect Oriented Programming (AOP) is a methodology that provides separation of crosscutting concernsby introducing an Aspect, a new unit of modularization. Each aspect focuses on a particular crosscuttingfunction. Main classes are no longer plagued with crosscutting concerns. The aspect weaver assembles thefinal system by combining main classes and crosscutting aspects through a process called weaving. Therefore,with the use of the methodology, applications that are easy to design, implement and maintain would becreated.III. METHODOLOGY A. About the data used In this work, we use the Employee data table of the Oracle HR scheme. It consists of 10,000 records for tests.Four basic queries: selection, insertion, update, and elimination, are performed.26Medoza-Palomino et al. Comparative analysis of the efficiency of Data Persistence Frameworks. Case study Hibernate 5.4 and MyBatis 3.4ISSN-E: 2542-3401, ISSN-P: 1316-4821Universidad, Ciencia y Tecnología, Vol. 26, Núm. 117, (pp. 24-32)
The rest-client: Implements a REST client and through threads, we send a hundred requestssimultaneously; fifty of which are directed towards a REST service of hr-rest-MyBatis and the other fiftytowards a REST of hr-rest-hibernate, in this way we subject our applications to a stressful situation sinceeach REST service will have to process fifty requests simultaneously.The hr-rest-mybatis: microservice implemented with MyBatis. This microservice exposes four RESTservices.B. Employees table DDL CREATE TABLE "HR"."EMPLOYEES" ( "EMPLOYEE_ID" NUMBER(6,0), "FIRST_NAME" VARCHAR2(20 BYTE), "