Compare with

Comparison of OpenJPA with Derby embedded vs Hibernate 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
 OpenJPA
Derby embedded
Hibernate
MySQL server
OpenJPA
Derby embedded
Hibernate
MySQL server
OpenJPA
Derby embedded
Hibernate
MySQL server
Basic Person Test4.83.62.91.63.92.6
Element Collection Test2.81.61.90.722.41.1
Inheritance Test4.13.72.41.63.32.7
Indexing Test6.15.44.12.65.14.0
Graph (Binary Tree) Test1.51.51.41.21.41.4
Multithreading Test8.77.43.32.96.05.2
All Tests4.73.92.71.83.72.8

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

A large performance gap has been detected when using JPA element collections with large transaction size. Comparing the normalized speed of Hibernate with MySQL database server (0.72) to the normalized speed of OpenJPA with Derby embedded database (1.9) reveals that in that case, OpenJPA with Derby embedded is 2.6 times faster than Hibernate with MySQL server.

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

Retrieval Size =>Few EntitiesMany EntitiesAverage Score
 OpenJPA
Derby embedded
Hibernate
MySQL server
OpenJPA
Derby embedded
Hibernate
MySQL server
OpenJPA
Derby embedded
Hibernate
MySQL server
Basic Person Test14.83.022.611.018.77.0
Element Collection Test0.00310.342.31.21.20.79
Inheritance Test0.0151.37.014.53.57.9
Indexing Test11.72.526.512.819.17.6
Graph (Binary Tree) Test0.930.551.20.711.10.63
Multithreading Test25.20.2328.613.826.97.0
All Tests8.81.314.79.011.75.2

The results above show that in general OpenJPA with Derby embedded is more efficient than Hibernate with MySQL server in retrieving JPA entity objects from the database. Comparing the normalized speed of Hibernate with MySQL database server (5.2) to the normalized speed of OpenJPA with Derby embedded database (11.7) reveals that in these tests, OpenJPA with Derby embedded is 2.2 times faster than Hibernate with MySQL server.

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

On the other hand, OpenJPA with Derby embedded is slower, for instance, when using JPA element collections with small retrieval size. Comparing the normalized speed of OpenJPA with Derby embedded database (0.0031) to the normalized speed of Hibernate with MySQL database server (0.34) reveals that in that case, OpenJPA with Derby embedded is 110 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
 OpenJPA
Derby embedded
Hibernate
MySQL server
OpenJPA
Derby embedded
Hibernate
MySQL server
OpenJPA
Derby embedded
Hibernate
MySQL server
Basic Person Test49.710.09.92.029.86.0
Element Collection Test2.76.79.60.536.13.6
Inheritance Test2.32.81.31.61.82.2
Indexing Test7.00.4417.12.012.11.2
Multithreading Test40.92.111.70.9826.31.5
All Tests20.54.49.91.415.22.9

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

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

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

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

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 OpenJPA
Derby embedded
Hibernate
MySQL server
OpenJPA
Derby embedded
Hibernate
MySQL server
OpenJPA
Derby embedded
Hibernate
MySQL server
Basic Person Test5.60.735.21.65.41.2
Element Collection Test0.00900.392.21.21.10.78
Inheritance Test0.0450.614.62.12.31.4
Indexing Test6.10.818.72.67.41.7
Graph (Binary Tree) Test1.60.690.910.401.30.54
Multithreading Test18.30.634.53.011.41.8
All Tests5.30.644.41.84.81.2

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

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

On the other hand, OpenJPA with Derby embedded is slower, for instance, when using JPA element collections with small transaction size. Comparing the normalized speed of OpenJPA with Derby embedded database (0.0090) to the normalized speed of Hibernate with MySQL database server (0.39) reveals that in that case, OpenJPA with Derby embedded is 43.3 times slower than Hibernate with MySQL server.

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

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 OpenJPA
Derby embedded
Hibernate
MySQL server
OpenJPA
Derby embedded
Hibernate
MySQL server
OpenJPA
Derby embedded
Hibernate
MySQL server
Basic Person Test4.21.14.51.74.31.4
Element Collection Test0.00710.211.60.530.800.37
Inheritance Test0.0350.653.01.81.51.2
Indexing Test5.30.813.62.04.41.4
Graph (Binary Tree) Test0.800.550.930.620.860.58
Multithreading Test5.70.356.24.16.02.2
All Tests2.70.613.31.83.01.2

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

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

On the other hand, OpenJPA with Derby embedded is slower, for instance, when using JPA element collections with small transaction size. Comparing the normalized speed of OpenJPA with Derby embedded database (0.0071) to the normalized speed of Hibernate with MySQL database server (0.21) reveals that in that case, OpenJPA with Derby embedded is 29.6 times slower than Hibernate with MySQL server.

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

Transaction/Retrieval SizeFew EntitiesMany EntitiesAverage Score
 OpenJPA
Derby embedded
Hibernate
MySQL server
OpenJPA
Derby embedded
Hibernate
MySQL server
OpenJPA
Derby embedded
Hibernate
MySQL server
Basic Person Test15.83.79.03.612.43.6
Element Collection Test1.11.83.50.842.31.3
Inheritance Test1.31.83.74.32.53.1
Indexing Test7.22.012.04.49.63.2
Graph (Binary Tree) Test1.20.831.10.731.20.78
Multithreading Test19.82.110.95.015.33.6
All Tests8.02.16.93.27.42.7

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

A large performance gap has been detected when using multithreading with small transaction/retrieval size. Comparing the normalized speed of Hibernate with MySQL database server (2.1) to the normalized speed of OpenJPA with Derby embedded database (19.8) reveals that in that case, OpenJPA with Derby embedded is 9.4 times faster than Hibernate with MySQL server.

Other Head to Head DBMS/JPA Comparisons