Compare with

Comparison of OpenJPA with H2 embedded vs Hibernate with Derby embedded

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
H2 embedded
Hibernate
Derby embedded
OpenJPA
H2 embedded
Hibernate
Derby embedded
OpenJPA
H2 embedded
Hibernate
Derby embedded
Basic Person Test17.15.95.83.811.54.9
Element Collection Test10.92.94.91.87.92.3
Inheritance Test14.35.35.93.710.14.5
Indexing Test24.47.013.74.819.15.9
Graph (Binary Tree) Test6.81.96.71.76.71.8
Multithreading Test34.210.510.23.722.27.1
All Tests17.95.67.93.312.94.4

The results above show that in general OpenJPA with H2 embedded is more efficient than Hibernate with Derby embedded in persisting JPA entity objects to the database. Comparing the normalized speed of Hibernate with Derby embedded database (4.4) to the normalized speed of OpenJPA with H2 embedded database (12.9) reveals that in these tests, OpenJPA with H2 embedded is 2.9 times faster than Hibernate with Derby embedded.

A large performance gap has been detected when using graphs of objects with large transaction size. Comparing the normalized speed of Hibernate with Derby embedded database (1.7) to the normalized speed of OpenJPA with H2 embedded database (6.7) reveals that in that case, OpenJPA with H2 embedded is 3.9 times faster than Hibernate with Derby embedded.

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

Retrieval Size =>Few EntitiesMany EntitiesAverage Score
 OpenJPA
H2 embedded
Hibernate
Derby embedded
OpenJPA
H2 embedded
Hibernate
Derby embedded
OpenJPA
H2 embedded
Hibernate
Derby embedded
Basic Person Test14.614.227.216.420.915.3
Element Collection Test0.00464.44.34.92.14.6
Inheritance Test0.01110.37.418.63.714.4
Indexing Test17.010.035.016.426.013.2
Graph (Binary Tree) Test1.02.61.43.01.22.8
Multithreading Test18.719.327.619.323.119.3
All Tests8.610.117.113.112.811.6

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

A large performance gap has been detected when using database indexes with large retrieval size. Comparing the normalized speed of Hibernate with Derby embedded database (16.4) to the normalized speed of OpenJPA with H2 embedded database (35.0) reveals that in that case, OpenJPA with H2 embedded is 2.1 times faster than Hibernate with Derby embedded.

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

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

Retrieval Size =>Few EntitiesMany EntitiesAverage Score
 OpenJPA
H2 embedded
Hibernate
Derby embedded
OpenJPA
H2 embedded
Hibernate
Derby embedded
OpenJPA
H2 embedded
Hibernate
Derby embedded
Basic Person Test5.049.31.16.83.128.1
Element Collection Test1.737.61.32.71.520.1
Inheritance Test2.224.11.27.61.715.9
Indexing Test13.85.323.214.818.510.1
Multithreading Test1.439.70.606.10.9922.9
All Tests4.831.25.57.65.119.4

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

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

On the other hand, Hibernate with Derby embedded is slower, for instance, when using database indexes with small retrieval size. Comparing the normalized speed of Hibernate with Derby embedded database (5.3) to the normalized speed of OpenJPA with H2 embedded database (13.8) reveals that in that case, Hibernate with Derby embedded is 2.6 times slower than OpenJPA with H2 embedded.

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

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 OpenJPA
H2 embedded
Hibernate
Derby embedded
OpenJPA
H2 embedded
Hibernate
Derby embedded
OpenJPA
H2 embedded
Hibernate
Derby embedded
Basic Person Test10.04.56.03.28.03.8
Element Collection Test0.0113.93.83.11.93.5
Inheritance Test0.0464.65.04.52.54.5
Indexing Test8.94.67.05.58.05.1
Graph (Binary Tree) Test2.42.71.31.21.92.0
Multithreading Test16.611.64.32.610.47.1
All Tests6.35.34.63.35.44.3

The results above show that in general OpenJPA with H2 embedded is slightly more efficient than Hibernate with Derby embedded in updating JPA entity objects in the database.

A large performance gap has been detected when using simple basic entities with small transaction size. Comparing the normalized speed of Hibernate with Derby embedded database (4.5) to the normalized speed of OpenJPA with H2 embedded database (10.0) reveals that in that case, OpenJPA with H2 embedded is 2.2 times faster than Hibernate with Derby embedded.

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

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

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 OpenJPA
H2 embedded
Hibernate
Derby embedded
OpenJPA
H2 embedded
Hibernate
Derby embedded
OpenJPA
H2 embedded
Hibernate
Derby embedded
Basic Person Test18.33.811.14.214.74.0
Element Collection Test0.0122.32.91.51.41.9
Inheritance Test0.0304.06.64.33.34.2
Indexing Test23.25.59.73.616.44.6
Graph (Binary Tree) Test1.80.742.40.962.10.85
Multithreading Test31.25.617.34.924.25.3
All Tests12.43.78.33.310.43.5

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

A large performance gap has been detected when using multithreading with small transaction size. Comparing the normalized speed of Hibernate with Derby embedded database (5.6) to the normalized speed of OpenJPA with H2 embedded database (31.2) reveals that in that case, OpenJPA with H2 embedded is 5.6 times faster than Hibernate with Derby embedded.

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

Comparison of database storage efficiency (normalized score, higher is better)

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 OpenJPA
H2 embedded
Hibernate
Derby embedded
OpenJPA
H2 embedded
Hibernate
Derby embedded
OpenJPA
H2 embedded
Hibernate
Derby embedded
Basic Person Test27.052.727.052.727.052.7
Element Collection Test30.642.330.642.330.642.3
Inheritance Test27.049.227.049.227.049.2
Indexing Test31.653.032.153.931.953.4
Graph (Binary Tree) Test28.513.121.49.824.911.5
Multithreading Test33.949.39.28.821.529.0
All Tests29.843.324.536.127.239.7

The results above show that in general Hibernate with Derby embedded is more efficient than OpenJPA with H2 embedded in using disk space.

On the other hand, Hibernate with Derby embedded is slower, for instance, when using graphs of objects with large transaction size. Comparing the normalized score of Hibernate with Derby embedded database (9.8) to the normalized score of OpenJPA with H2 embedded database (21.4) reveals that in that case, Hibernate with Derby embedded is 2.2 times less efficient than OpenJPA with H2 embedded.

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

Transaction/Retrieval SizeFew EntitiesMany EntitiesAverage Score
 OpenJPA
H2 embedded
Hibernate
Derby embedded
OpenJPA
H2 embedded
Hibernate
Derby embedded
OpenJPA
H2 embedded
Hibernate
Derby embedded
Basic Person Test13.015.510.26.911.611.2
Element Collection Test2.510.23.42.83.06.5
Inheritance Test3.39.75.27.74.38.7
Indexing Test17.56.517.79.017.67.8
Graph (Binary Tree) Test3.02.03.01.73.01.8
Multithreading Test20.417.312.07.316.212.3
All Tests10.210.58.86.19.58.3

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

A large performance gap has been detected when using database indexes with small transaction/retrieval size. Comparing the normalized speed of Hibernate with Derby embedded database (6.5) to the normalized speed of OpenJPA with H2 embedded database (17.5) reveals that in that case, OpenJPA with H2 embedded is 2.7 times faster than Hibernate with Derby embedded.

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

Other Head to Head DBMS/JPA Comparisons