Compare with

Comparison of OpenJPA with MySQL server vs Hibernate with Derby 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
 OpenJPA
MySQL server
Hibernate
Derby server
OpenJPA
MySQL server
Hibernate
Derby server
OpenJPA
MySQL server
Hibernate
Derby server
Basic Person Test3.93.81.63.02.73.4
Element Collection Test1.62.00.681.31.11.7
Inheritance Test3.63.41.43.02.53.2
Indexing Test5.64.82.44.14.04.4
Graph (Binary Tree) Test0.681.80.571.60.631.7
Multithreading Test7.26.92.73.94.95.4
All Tests3.73.81.52.82.63.3

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
 OpenJPA
MySQL server
Hibernate
Derby server
OpenJPA
MySQL server
Hibernate
Derby server
OpenJPA
MySQL server
Hibernate
Derby server
Basic Person Test3.23.822.78.412.96.1
Element Collection Test0.00381.02.91.01.41.0
Inheritance Test0.0173.56.99.73.46.6
Indexing Test2.43.223.49.512.96.4
Graph (Binary Tree) Test0.270.910.351.20.311.1
Multithreading Test0.147.818.113.49.110.6
All Tests1.03.412.47.26.75.3

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
 OpenJPA
MySQL server
Hibernate
Derby server
OpenJPA
MySQL server
Hibernate
Derby server
OpenJPA
MySQL server
Hibernate
Derby server
Basic Person Test9.334.02.24.15.819.1
Element Collection Test4.833.81.10.642.917.2
Inheritance Test1.520.50.905.01.212.8
Indexing Test0.312.02.19.21.25.6
Multithreading Test1.936.20.995.11.420.6
All Tests3.625.31.54.82.515.1

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
 OpenJPA
MySQL server
Hibernate
Derby server
OpenJPA
MySQL server
Hibernate
Derby server
OpenJPA
MySQL server
Hibernate
Derby server
Basic Person Test0.742.91.62.51.22.7
Element Collection Test0.0142.31.71.50.871.9
Inheritance Test0.0482.92.03.51.03.2
Indexing Test0.743.03.04.21.93.6
Graph (Binary Tree) Test0.451.20.250.580.350.91
Multithreading Test0.556.82.92.51.74.6
All Tests0.423.21.92.51.22.8

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
 OpenJPA
MySQL server
Hibernate
Derby server
OpenJPA
MySQL server
Hibernate
Derby server
OpenJPA
MySQL server
Hibernate
Derby server
Basic Person Test0.982.91.73.51.43.2
Element Collection Test0.00991.70.650.870.331.3
Inheritance Test0.0332.91.53.60.753.2
Indexing Test0.643.72.03.61.33.7
Graph (Binary Tree) Test0.410.690.430.700.420.70
Multithreading Test0.276.22.95.11.65.6
All Tests0.393.01.52.90.963.0

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
 OpenJPA
MySQL server
Hibernate
Derby server
OpenJPA
MySQL server
Hibernate
Derby server
OpenJPA
MySQL server
Hibernate
Derby server
Basic Person Test3.69.56.04.34.86.9
Element Collection Test1.38.21.41.11.34.6
Inheritance Test1.06.62.55.01.85.8
Indexing Test1.93.36.66.14.34.7
Graph (Binary Tree) Test0.451.20.401.00.431.1
Multithreading Test2.012.85.56.03.89.4
All Tests1.87.13.94.02.85.6

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