Compare with

Comparison of Hibernate with Derby embedded vs OpenJPA with H2 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
 Hibernate
Derby embedded
OpenJPA
H2 embedded
Hibernate
Derby embedded
OpenJPA
H2 embedded
Hibernate
Derby embedded
OpenJPA
H2 embedded
Basic Person Test5.917.13.85.84.911.5
Element Collection Test2.910.91.84.92.37.9
Inheritance Test5.314.33.75.94.510.1
Indexing Test7.024.44.813.75.919.1
Graph (Binary Tree) Test1.96.81.76.71.86.7
Multithreading Test10.534.23.710.27.122.2
All Tests5.617.93.37.94.412.9

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
 Hibernate
Derby embedded
OpenJPA
H2 embedded
Hibernate
Derby embedded
OpenJPA
H2 embedded
Hibernate
Derby embedded
OpenJPA
H2 embedded
Basic Person Test14.214.616.427.215.320.9
Element Collection Test4.40.00464.94.34.62.1
Inheritance Test10.30.01118.67.414.43.7
Indexing Test10.017.016.435.013.226.0
Graph (Binary Tree) Test2.61.03.01.42.81.2
Multithreading Test19.318.719.327.619.323.1
All Tests10.18.613.117.111.612.8

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
 Hibernate
Derby embedded
OpenJPA
H2 embedded
Hibernate
Derby embedded
OpenJPA
H2 embedded
Hibernate
Derby embedded
OpenJPA
H2 embedded
Basic Person Test49.35.06.81.128.13.1
Element Collection Test37.61.72.71.320.11.5
Inheritance Test24.12.27.61.215.91.7
Indexing Test5.313.814.823.210.118.5
Multithreading Test39.71.46.10.6022.90.99
All Tests31.24.87.65.519.45.1

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
 Hibernate
Derby embedded
OpenJPA
H2 embedded
Hibernate
Derby embedded
OpenJPA
H2 embedded
Hibernate
Derby embedded
OpenJPA
H2 embedded
Basic Person Test4.510.03.26.03.88.0
Element Collection Test3.90.0113.13.83.51.9
Inheritance Test4.60.0464.55.04.52.5
Indexing Test4.68.95.57.05.18.0
Graph (Binary Tree) Test2.72.41.21.32.01.9
Multithreading Test11.616.62.64.37.110.4
All Tests5.36.33.34.64.35.4

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
 Hibernate
Derby embedded
OpenJPA
H2 embedded
Hibernate
Derby embedded
OpenJPA
H2 embedded
Hibernate
Derby embedded
OpenJPA
H2 embedded
Basic Person Test3.818.34.211.14.014.7
Element Collection Test2.30.0121.52.91.91.4
Inheritance Test4.00.0304.36.64.23.3
Indexing Test5.523.23.69.74.616.4
Graph (Binary Tree) Test0.741.80.962.40.852.1
Multithreading Test5.631.24.917.35.324.2
All Tests3.712.43.38.33.510.4

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
 Hibernate
Derby embedded
OpenJPA
H2 embedded
Hibernate
Derby embedded
OpenJPA
H2 embedded
Hibernate
Derby embedded
OpenJPA
H2 embedded
Basic Person Test52.727.052.727.052.727.0
Element Collection Test42.330.642.330.642.330.6
Inheritance Test49.227.049.227.049.227.0
Indexing Test53.031.653.932.153.431.9
Graph (Binary Tree) Test13.128.59.821.411.524.9
Multithreading Test49.333.98.89.229.021.5
All Tests43.329.836.124.539.727.2

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
 Hibernate
Derby embedded
OpenJPA
H2 embedded
Hibernate
Derby embedded
OpenJPA
H2 embedded
Hibernate
Derby embedded
OpenJPA
H2 embedded
Basic Person Test15.513.06.910.211.211.6
Element Collection Test10.22.52.83.46.53.0
Inheritance Test9.73.37.75.28.74.3
Indexing Test6.517.59.017.77.817.6
Graph (Binary Tree) Test2.03.01.73.01.83.0
Multithreading Test17.320.47.312.012.316.2
All Tests10.510.26.18.88.39.5

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