Compare with

Comparison of Hibernate with H2 server vs OpenJPA 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
 Hibernate
H2 server
OpenJPA
Derby server
Hibernate
H2 server
OpenJPA
Derby server
Hibernate
H2 server
OpenJPA
Derby server
Basic Person Test4.63.13.02.73.82.9
Element Collection Test3.72.01.11.72.41.8
Inheritance Test6.73.03.12.34.92.6
Indexing Test8.24.74.24.16.24.4
Graph (Binary Tree) Test3.40.713.90.643.70.67
Multithreading Test6.86.05.03.85.94.9
All Tests5.63.33.42.54.52.9

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

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

Retrieval Size =>Few EntitiesMany EntitiesAverage Score
 Hibernate
H2 server
OpenJPA
Derby server
Hibernate
H2 server
OpenJPA
Derby server
Hibernate
H2 server
OpenJPA
Derby server
Basic Person Test3.10.786.011.64.66.2
Element Collection Test1.00.00241.11.11.00.54
Inheritance Test2.90.0147.65.05.22.5
Indexing Test2.60.627.013.04.86.8
Graph (Binary Tree) Test0.420.0651.10.390.780.23
Multithreading Test6.51.610.519.08.510.3
All Tests2.80.515.68.44.24.4

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

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

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

Retrieval Size =>Few EntitiesMany EntitiesAverage Score
 Hibernate
H2 server
OpenJPA
Derby server
Hibernate
H2 server
OpenJPA
Derby server
Hibernate
H2 server
OpenJPA
Derby server
Basic Person Test3.729.21.05.52.317.3
Element Collection Test3.72.20.631.42.21.8
Inheritance Test3.22.21.41.02.31.6
Indexing Test1.72.25.811.73.87.0
Multithreading Test1.135.50.888.31.021.9
All Tests2.714.31.95.62.39.9

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

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

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

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 Hibernate
H2 server
OpenJPA
Derby server
Hibernate
H2 server
OpenJPA
Derby server
Hibernate
H2 server
OpenJPA
Derby server
Basic Person Test2.91.51.84.02.42.8
Element Collection Test2.60.00811.11.91.90.94
Inheritance Test3.20.0432.53.82.91.9
Indexing Test2.91.82.76.82.84.3
Graph (Binary Tree) Test1.20.160.430.270.790.22
Multithreading Test5.66.92.45.04.05.9
All Tests3.11.71.83.62.52.7

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

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

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

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

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 Hibernate
H2 server
OpenJPA
Derby server
Hibernate
H2 server
OpenJPA
Derby server
Hibernate
H2 server
OpenJPA
Derby server
Basic Person Test3.81.42.43.73.12.5
Element Collection Test1.90.00821.11.41.50.71
Inheritance Test3.70.0352.52.53.11.3
Indexing Test7.62.33.13.55.32.9
Graph (Binary Tree) Test0.990.130.910.350.950.24
Multithreading Test6.13.67.34.06.73.8
All Tests4.01.32.92.63.51.9

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

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

Transaction/Retrieval SizeFew EntitiesMany EntitiesAverage Score
 Hibernate
H2 server
OpenJPA
Derby server
Hibernate
H2 server
OpenJPA
Derby server
Hibernate
H2 server
OpenJPA
Derby server
Basic Person Test3.67.22.85.53.26.4
Element Collection Test2.60.841.01.51.81.2
Inheritance Test4.01.13.42.93.72.0
Indexing Test4.62.34.57.84.65.1
Graph (Binary Tree) Test1.50.271.60.411.60.34
Multithreading Test5.210.75.28.05.29.4
All Tests3.73.93.24.53.44.2

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

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

On the other hand, OpenJPA with Derby server is slower, for instance, when using graphs of objects with small transaction/retrieval size. Comparing the normalized speed of OpenJPA with Derby database server (0.27) to the normalized speed of Hibernate with H2 database server (1.5) reveals that in that case, OpenJPA with Derby server is 5.6 times slower than Hibernate with H2 server.

Other Head to Head DBMS/JPA Comparisons