Compare with

Comparison of OpenJPA with H2 server 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 server
Hibernate
Derby embedded
OpenJPA
H2 server
Hibernate
Derby embedded
OpenJPA
H2 server
Hibernate
Derby embedded
Basic Person Test3.75.92.23.82.94.9
Element Collection Test2.62.91.51.82.12.3
Inheritance Test4.55.32.03.73.24.5
Indexing Test7.37.03.64.85.45.9
Graph (Binary Tree) Test1.11.90.841.70.971.8
Multithreading Test7.710.54.23.75.97.1
All Tests4.55.62.43.33.44.4

The results above show that in general Hibernate with Derby embedded is slightly more efficient than OpenJPA with H2 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 H2 database server (0.84) to the normalized speed of Hibernate with Derby embedded database (1.7) reveals that in that case, Hibernate with Derby embedded is 2.0 times faster than OpenJPA with H2 server.

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

Retrieval Size =>Few EntitiesMany EntitiesAverage Score
 OpenJPA
H2 server
Hibernate
Derby embedded
OpenJPA
H2 server
Hibernate
Derby embedded
OpenJPA
H2 server
Hibernate
Derby embedded
Basic Person Test2.914.27.616.45.215.3
Element Collection Test0.00224.41.94.90.934.6
Inheritance Test0.01310.34.018.62.014.4
Indexing Test4.110.08.816.46.513.2
Graph (Binary Tree) Test0.382.60.493.00.442.8
Multithreading Test5.919.314.019.310.019.3
All Tests2.210.16.113.14.211.6

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

A huge performance gap has been detected when using JPA element collections with small retrieval size. Comparing the normalized speed of OpenJPA with H2 database server (0.0022) to the normalized speed of Hibernate with Derby embedded database (4.4) reveals that in that case, Hibernate with Derby embedded is 2,000 times faster than OpenJPA with H2 server.

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

Retrieval Size =>Few EntitiesMany EntitiesAverage Score
 OpenJPA
H2 server
Hibernate
Derby embedded
OpenJPA
H2 server
Hibernate
Derby embedded
OpenJPA
H2 server
Hibernate
Derby embedded
Basic Person Test3.749.31.06.82.428.1
Element Collection Test2.037.61.22.71.620.1
Inheritance Test2.824.11.17.62.015.9
Indexing Test3.85.37.514.85.710.1
Multithreading Test0.9839.71.06.11.022.9
All Tests2.731.22.47.62.519.4

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

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

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

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 OpenJPA
H2 server
Hibernate
Derby embedded
OpenJPA
H2 server
Hibernate
Derby embedded
OpenJPA
H2 server
Hibernate
Derby embedded
Basic Person Test3.04.52.03.22.53.8
Element Collection Test0.00783.91.93.10.943.5
Inheritance Test0.0344.62.84.51.44.5
Indexing Test2.84.63.25.53.05.1
Graph (Binary Tree) Test0.792.70.431.20.612.0
Multithreading Test7.011.62.52.64.87.1
All Tests2.35.32.13.32.24.3

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

A huge performance gap has been detected when using JPA element collections with small transaction size. Comparing the normalized speed of OpenJPA with H2 database server (0.0078) to the normalized speed of Hibernate with Derby embedded database (3.9) reveals that in that case, Hibernate with Derby embedded is 500 times faster than OpenJPA with H2 server.

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

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 OpenJPA
H2 server
Hibernate
Derby embedded
OpenJPA
H2 server
Hibernate
Derby embedded
OpenJPA
H2 server
Hibernate
Derby embedded
Basic Person Test3.23.82.24.22.74.0
Element Collection Test0.00602.30.881.50.441.9
Inheritance Test0.0304.03.14.31.64.2
Indexing Test6.55.53.63.65.14.6
Graph (Binary Tree) Test0.730.740.750.960.740.85
Multithreading Test7.65.65.24.96.45.3
All Tests3.03.72.63.32.83.5

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

A huge performance gap has been detected when using JPA element collections with small transaction size. Comparing the normalized speed of OpenJPA with H2 database server (0.0060) to the normalized speed of Hibernate with Derby embedded database (2.3) reveals that in that case, Hibernate with Derby embedded is 383 times faster than OpenJPA with H2 server.

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

Transaction/Retrieval SizeFew EntitiesMany EntitiesAverage Score
 OpenJPA
H2 server
Hibernate
Derby embedded
OpenJPA
H2 server
Hibernate
Derby embedded
OpenJPA
H2 server
Hibernate
Derby embedded
Basic Person Test3.315.53.06.93.111.2
Element Collection Test0.9310.21.52.81.26.5
Inheritance Test1.59.72.67.72.08.7
Indexing Test4.96.55.49.05.17.8
Graph (Binary Tree) Test0.752.00.631.70.691.8
Multithreading Test5.917.35.47.35.612.3
All Tests2.910.53.26.13.08.3

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

A huge performance gap has been detected when using JPA element collections with small transaction/retrieval size. Comparing the normalized speed of OpenJPA with H2 database server (0.93) to the normalized speed of Hibernate with Derby embedded database (10.2) reveals that in that case, Hibernate with Derby embedded is 11.0 times faster than OpenJPA with H2 server.

Other Head to Head DBMS/JPA Comparisons