Compare with

Comparison of Hibernate with MySQL server vs OpenJPA with MySQL server

Each of the following tables focuses on a specific database operation, where the last table presents average results comparison.

Speed comparison of JPA database persistence operations (normalized score, higher is better)

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 Hibernate
MySQL server
OpenJPA
MySQL server
Hibernate
MySQL server
OpenJPA
MySQL server
Hibernate
MySQL server
OpenJPA
MySQL server
Basic Person Test3.63.91.61.62.62.7
Element Collection Test1.61.60.720.681.11.1
Inheritance Test3.73.61.61.42.72.5
Indexing Test5.45.62.62.44.04.0
Graph (Binary Tree) Test1.50.681.20.571.40.63
Multithreading Test7.47.22.92.75.24.9
All Tests3.93.71.81.52.82.6

The results above show that in general Hibernate with MySQL server is slightly more efficient than OpenJPA with MySQL server in persisting JPA entity objects to the database.

A large performance gap has been detected when using graphs of objects with small transaction size. Comparing the normalized speed of OpenJPA with MySQL database server (0.68) to the normalized speed of Hibernate with MySQL database server (1.5) reveals that in that case, Hibernate with MySQL server is 2.2 times faster than OpenJPA with MySQL server.

Speed comparison of JPA database retrieval operations (normalized score, higher is better)

Retrieval Size =>Few EntitiesMany EntitiesAverage Score
 Hibernate
MySQL server
OpenJPA
MySQL server
Hibernate
MySQL server
OpenJPA
MySQL server
Hibernate
MySQL server
OpenJPA
MySQL server
Basic Person Test3.03.211.022.77.012.9
Element Collection Test0.340.00381.22.90.791.4
Inheritance Test1.30.01714.56.97.93.4
Indexing Test2.52.412.823.47.612.9
Graph (Binary Tree) Test0.550.270.710.350.630.31
Multithreading Test0.230.1413.818.17.09.1
All Tests1.31.09.012.45.26.7

The results above show that in general OpenJPA with MySQL server is slightly more efficient than Hibernate with MySQL server in retrieving JPA entity objects from the database.

A large performance gap has been detected when using JPA element collections with large retrieval size. Comparing the normalized speed of Hibernate with MySQL database server (1.2) to the normalized speed of OpenJPA with MySQL database server (2.9) reveals that in that case, OpenJPA with MySQL server is 2.4 times faster than Hibernate with MySQL server.

On the other hand, OpenJPA with MySQL server is slower, for instance, when using JPA element collections with small retrieval size. Comparing the normalized speed of OpenJPA with MySQL database server (0.0038) to the normalized speed of Hibernate with MySQL database server (0.34) reveals that in that case, OpenJPA with MySQL server is 89.5 times slower than Hibernate with MySQL server.

Speed comparison of JPA database query operations (normalized score, higher is better)

Retrieval Size =>Few EntitiesMany EntitiesAverage Score
 Hibernate
MySQL server
OpenJPA
MySQL server
Hibernate
MySQL server
OpenJPA
MySQL server
Hibernate
MySQL server
OpenJPA
MySQL server
Basic Person Test10.09.32.02.26.05.8
Element Collection Test6.74.80.531.13.62.9
Inheritance Test2.81.51.60.902.21.2
Indexing Test0.440.312.02.11.21.2
Multithreading Test2.11.90.980.991.51.4
All Tests4.43.61.41.52.92.5

The results above show that in general Hibernate with MySQL server is slightly more efficient than OpenJPA with MySQL server in executing the tested JPA queries.

On the other hand, Hibernate with MySQL server is slower, for instance, when using JPA element collections with large retrieval size. Comparing the normalized speed of Hibernate with MySQL database server (0.53) to the normalized speed of OpenJPA with MySQL database server (1.1) reveals that in that case, Hibernate with MySQL server is 2.1 times slower than OpenJPA with MySQL server.

Speed comparison of JPA database update operations (normalized score, higher is better)

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 Hibernate
MySQL server
OpenJPA
MySQL server
Hibernate
MySQL server
OpenJPA
MySQL server
Hibernate
MySQL server
OpenJPA
MySQL server
Basic Person Test0.730.741.61.61.21.2
Element Collection Test0.390.0141.21.70.780.87
Inheritance Test0.610.0482.12.01.41.0
Indexing Test0.810.742.63.01.71.9
Graph (Binary Tree) Test0.690.450.400.250.540.35
Multithreading Test0.630.553.02.91.81.7
All Tests0.640.421.81.91.21.2

The results above show that in general Hibernate with MySQL server is equivalent to OpenJPA with MySQL server in updating JPA entity objects in the database.

A huge performance gap has been detected when using JPA element collections with small transaction size. Comparing the normalized speed of OpenJPA with MySQL database server (0.014) to the normalized speed of Hibernate with MySQL database server (0.39) reveals that in that case, Hibernate with MySQL server is 27.9 times faster than OpenJPA with MySQL server.

Speed comparison of JPA database removal operations (normalized score, higher is better)

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 Hibernate
MySQL server
OpenJPA
MySQL server
Hibernate
MySQL server
OpenJPA
MySQL server
Hibernate
MySQL server
OpenJPA
MySQL server
Basic Person Test1.10.981.71.71.41.4
Element Collection Test0.210.00990.530.650.370.33
Inheritance Test0.650.0331.81.51.20.75
Indexing Test0.810.642.02.01.41.3
Graph (Binary Tree) Test0.550.410.620.430.580.42
Multithreading Test0.350.274.12.92.21.6
All Tests0.610.391.81.51.20.96

The results above show that in general Hibernate with MySQL server is slightly more efficient than OpenJPA with MySQL server in deleting JPA entity objects from the database.

A huge performance gap has been detected when using JPA element collections with small transaction size. Comparing the normalized speed of OpenJPA with MySQL database server (0.0099) to the normalized speed of Hibernate with MySQL database server (0.21) reveals that in that case, Hibernate with MySQL server is 21.2 times faster than OpenJPA with MySQL server.

Comparison of JPA/Database speed - the averages (normalized score, higher is better)

Transaction/Retrieval SizeFew EntitiesMany EntitiesAverage Score
 Hibernate
MySQL server
OpenJPA
MySQL server
Hibernate
MySQL server
OpenJPA
MySQL server
Hibernate
MySQL server
OpenJPA
MySQL server
Basic Person Test3.73.63.66.03.64.8
Element Collection Test1.81.30.841.41.31.3
Inheritance Test1.81.04.32.53.11.8
Indexing Test2.01.94.46.63.24.3
Graph (Binary Tree) Test0.830.450.730.400.780.43
Multithreading Test2.12.05.05.53.63.8
All Tests2.11.83.23.92.72.8

The results above show that in general OpenJPA with MySQL server is slightly more efficient than Hibernate with MySQL server in performing JPA database operations.

Other Head to Head DBMS/JPA Comparisons