Compare with

Comparison of OpenJPA with H2 embedded 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
H2 embedded
Hibernate
Derby server
OpenJPA
H2 embedded
Hibernate
Derby server
OpenJPA
H2 embedded
Hibernate
Derby server
Basic Person Test17.13.85.83.011.53.4
Element Collection Test10.92.04.91.37.91.7
Inheritance Test14.33.45.93.010.13.2
Indexing Test24.44.813.74.119.14.4
Graph (Binary Tree) Test6.81.86.71.66.71.7
Multithreading Test34.26.910.23.922.25.4
All Tests17.93.87.92.812.93.3

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

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

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

Retrieval Size =>Few EntitiesMany EntitiesAverage Score
 OpenJPA
H2 embedded
Hibernate
Derby server
OpenJPA
H2 embedded
Hibernate
Derby server
OpenJPA
H2 embedded
Hibernate
Derby server
Basic Person Test14.63.827.28.420.96.1
Element Collection Test0.00461.04.31.02.11.0
Inheritance Test0.0113.57.49.73.76.6
Indexing Test17.03.235.09.526.06.4
Graph (Binary Tree) Test1.00.911.41.21.21.1
Multithreading Test18.77.827.613.423.110.6
All Tests8.63.417.17.212.85.3

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

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

On the other hand, OpenJPA with H2 embedded is slower, for instance, when using class inheritance in the object model with small retrieval size. Comparing the normalized speed of OpenJPA with H2 embedded database (0.011) to the normalized speed of Hibernate with Derby database server (3.5) reveals that in that case, OpenJPA with H2 embedded is 318 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
H2 embedded
Hibernate
Derby server
OpenJPA
H2 embedded
Hibernate
Derby server
OpenJPA
H2 embedded
Hibernate
Derby server
Basic Person Test5.034.01.14.13.119.1
Element Collection Test1.733.81.30.641.517.2
Inheritance Test2.220.51.25.01.712.8
Indexing Test13.82.023.29.218.55.6
Multithreading Test1.436.20.605.10.9920.6
All Tests4.825.35.54.85.115.1

The results above show that in general Hibernate with Derby server is 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 database server (15.1) reveals that in these tests, Hibernate with Derby server is 3.0 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 database server (36.2) reveals that in that case, Hibernate with Derby server is 25.9 times faster than OpenJPA with H2 embedded.

On the other hand, Hibernate with Derby server is slower, for instance, when using database indexes with small retrieval size. Comparing the normalized speed of Hibernate with Derby database server (2.0) to the normalized speed of OpenJPA with H2 embedded database (13.8) reveals that in that case, Hibernate with Derby server is 6.9 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 server
OpenJPA
H2 embedded
Hibernate
Derby server
OpenJPA
H2 embedded
Hibernate
Derby server
Basic Person Test10.02.96.02.58.02.7
Element Collection Test0.0112.33.81.51.91.9
Inheritance Test0.0462.95.03.52.53.2
Indexing Test8.93.07.04.28.03.6
Graph (Binary Tree) Test2.41.21.30.581.90.91
Multithreading Test16.66.84.32.510.44.6
All Tests6.33.24.62.55.42.8

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

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 database server (2.3) reveals that in that case, OpenJPA with H2 embedded is 209 times slower than Hibernate with Derby server.

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

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 OpenJPA
H2 embedded
Hibernate
Derby server
OpenJPA
H2 embedded
Hibernate
Derby server
OpenJPA
H2 embedded
Hibernate
Derby server
Basic Person Test18.32.911.13.514.73.2
Element Collection Test0.0121.72.90.871.41.3
Inheritance Test0.0302.96.63.63.33.2
Indexing Test23.23.79.73.616.43.7
Graph (Binary Tree) Test1.80.692.40.702.10.70
Multithreading Test31.26.217.35.124.25.6
All Tests12.43.08.32.910.43.0

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

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

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 database server (1.7) reveals that in that case, OpenJPA with H2 embedded is 142 times slower than Hibernate with Derby server.

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

Transaction/Retrieval SizeFew EntitiesMany EntitiesAverage Score
 OpenJPA
H2 embedded
Hibernate
Derby server
OpenJPA
H2 embedded
Hibernate
Derby server
OpenJPA
H2 embedded
Hibernate
Derby server
Basic Person Test13.09.510.24.311.66.9
Element Collection Test2.58.23.41.13.04.6
Inheritance Test3.36.65.25.04.35.8
Indexing Test17.53.317.76.117.64.7
Graph (Binary Tree) Test3.01.23.01.03.01.1
Multithreading Test20.412.812.06.016.29.4
All Tests10.27.18.84.09.55.6

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

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 database server (8.2) reveals that in that case, OpenJPA with H2 embedded is 3.3 times slower than Hibernate with Derby server.

Other Head to Head DBMS/JPA Comparisons