Compare with

Comparison of Hibernate with Derby 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
Derby server
OpenJPA
MySQL server
Hibernate
Derby server
OpenJPA
MySQL server
Hibernate
Derby server
OpenJPA
MySQL server
Basic Person Test3.83.93.01.63.42.7
Element Collection Test2.01.61.30.681.71.1
Inheritance Test3.43.63.01.43.22.5
Indexing Test4.85.64.12.44.44.0
Graph (Binary Tree) Test1.80.681.60.571.70.63
Multithreading Test6.97.23.92.75.44.9
All Tests3.83.72.81.53.32.6

The results above show that in general Hibernate with Derby 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 large transaction size. Comparing the normalized speed of OpenJPA with MySQL database server (0.57) to the normalized speed of Hibernate with Derby database server (1.6) reveals that in that case, Hibernate with Derby server is 2.8 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
Derby server
OpenJPA
MySQL server
Hibernate
Derby server
OpenJPA
MySQL server
Hibernate
Derby server
OpenJPA
MySQL server
Basic Person Test3.83.28.422.76.112.9
Element Collection Test1.00.00381.02.91.01.4
Inheritance Test3.50.0179.76.96.63.4
Indexing Test3.22.49.523.46.412.9
Graph (Binary Tree) Test0.910.271.20.351.10.31
Multithreading Test7.80.1413.418.110.69.1
All Tests3.41.07.212.45.36.7

The results above show that in general OpenJPA with MySQL server is slightly more efficient than Hibernate with Derby 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 Derby database server (1.0) to the normalized speed of OpenJPA with MySQL database server (2.9) reveals that in that case, OpenJPA with MySQL server is 2.9 times faster than Hibernate with Derby 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 Derby database server (1.0) reveals that in that case, OpenJPA with MySQL server is 263 times slower than Hibernate with Derby server.

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

Retrieval Size =>Few EntitiesMany EntitiesAverage Score
 Hibernate
Derby server
OpenJPA
MySQL server
Hibernate
Derby server
OpenJPA
MySQL server
Hibernate
Derby server
OpenJPA
MySQL server
Basic Person Test34.09.34.12.219.15.8
Element Collection Test33.84.80.641.117.22.9
Inheritance Test20.51.55.00.9012.81.2
Indexing Test2.00.319.22.15.61.2
Multithreading Test36.21.95.10.9920.61.4
All Tests25.33.64.81.515.12.5

The results above show that in general Hibernate with Derby server is much more efficient than OpenJPA with MySQL server in executing the tested JPA queries. Comparing the normalized speed of OpenJPA with MySQL database server (2.5) to the normalized speed of Hibernate with Derby database server (15.1) reveals that in these tests, Hibernate with Derby server is 6.0 times faster than OpenJPA with MySQL server.

A huge performance gap has been detected when using multithreading with small retrieval size. Comparing the normalized speed of OpenJPA with MySQL database server (1.9) to the normalized speed of Hibernate with Derby database server (36.2) reveals that in that case, Hibernate with Derby server is 19.1 times faster than OpenJPA with MySQL server.

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

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 Hibernate
Derby server
OpenJPA
MySQL server
Hibernate
Derby server
OpenJPA
MySQL server
Hibernate
Derby server
OpenJPA
MySQL server
Basic Person Test2.90.742.51.62.71.2
Element Collection Test2.30.0141.51.71.90.87
Inheritance Test2.90.0483.52.03.21.0
Indexing Test3.00.744.23.03.61.9
Graph (Binary Tree) Test1.20.450.580.250.910.35
Multithreading Test6.80.552.52.94.61.7
All Tests3.20.422.51.92.81.2

The results above show that in general Hibernate with Derby server is more efficient than OpenJPA with MySQL server in updating JPA entity objects in the database. Comparing the normalized speed of OpenJPA with MySQL database server (1.2) to the normalized speed of Hibernate with Derby database server (2.8) reveals that in these tests, Hibernate with Derby server is 2.3 times faster than OpenJPA with MySQL server.

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 Derby database server (2.3) reveals that in that case, Hibernate with Derby server is 164 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
Derby server
OpenJPA
MySQL server
Hibernate
Derby server
OpenJPA
MySQL server
Hibernate
Derby server
OpenJPA
MySQL server
Basic Person Test2.90.983.51.73.21.4
Element Collection Test1.70.00990.870.651.30.33
Inheritance Test2.90.0333.61.53.20.75
Indexing Test3.70.643.62.03.71.3
Graph (Binary Tree) Test0.690.410.700.430.700.42
Multithreading Test6.20.275.12.95.61.6
All Tests3.00.392.91.53.00.96

The results above show that in general Hibernate with Derby server is much more efficient than OpenJPA with MySQL server in deleting JPA entity objects from the database. Comparing the normalized speed of OpenJPA with MySQL database server (0.96) to the normalized speed of Hibernate with Derby database server (3.0) reveals that in these tests, Hibernate with Derby server is 3.1 times faster than OpenJPA with MySQL server.

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 Derby database server (1.7) reveals that in that case, Hibernate with Derby server is 172 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
Derby server
OpenJPA
MySQL server
Hibernate
Derby server
OpenJPA
MySQL server
Hibernate
Derby server
OpenJPA
MySQL server
Basic Person Test9.53.64.36.06.94.8
Element Collection Test8.21.31.11.44.61.3
Inheritance Test6.61.05.02.55.81.8
Indexing Test3.31.96.16.64.74.3
Graph (Binary Tree) Test1.20.451.00.401.10.43
Multithreading Test12.82.06.05.59.43.8
All Tests7.11.84.03.95.62.8

The results above show that in general Hibernate with Derby server is more efficient than OpenJPA with MySQL server in performing JPA database operations. Comparing the normalized speed of OpenJPA with MySQL database server (2.8) to the normalized speed of Hibernate with Derby database server (5.6) reveals that in these tests, Hibernate with Derby server is 2.0 times faster than OpenJPA with MySQL server.

A large performance gap has been detected when using class inheritance in the object model with small transaction/retrieval size. Comparing the normalized speed of OpenJPA with MySQL database server (1.0) to the normalized speed of Hibernate with Derby database server (6.6) reveals that in that case, Hibernate with Derby server is 6.6 times faster than OpenJPA with MySQL server.

Other Head to Head DBMS/JPA Comparisons