Compare with

Comparison of OpenJPA with Derby server vs Hibernate with H2 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
Derby server
Hibernate
H2 server
OpenJPA
Derby server
Hibernate
H2 server
OpenJPA
Derby server
Hibernate
H2 server
Basic Person Test3.14.62.73.02.93.8
Element Collection Test2.03.71.71.11.82.4
Inheritance Test3.06.72.33.12.64.9
Indexing Test4.78.24.14.24.46.2
Graph (Binary Tree) Test0.713.40.643.90.673.7
Multithreading Test6.06.83.85.04.95.9
All Tests3.35.62.53.42.94.5

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
 OpenJPA
Derby server
Hibernate
H2 server
OpenJPA
Derby server
Hibernate
H2 server
OpenJPA
Derby server
Hibernate
H2 server
Basic Person Test0.783.111.66.06.24.6
Element Collection Test0.00241.01.11.10.541.0
Inheritance Test0.0142.95.07.62.55.2
Indexing Test0.622.613.07.06.84.8
Graph (Binary Tree) Test0.0650.420.391.10.230.78
Multithreading Test1.66.519.010.510.38.5
All Tests0.512.88.45.64.44.2

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
 OpenJPA
Derby server
Hibernate
H2 server
OpenJPA
Derby server
Hibernate
H2 server
OpenJPA
Derby server
Hibernate
H2 server
Basic Person Test29.23.75.51.017.32.3
Element Collection Test2.23.71.40.631.82.2
Inheritance Test2.23.21.01.41.62.3
Indexing Test2.21.711.75.87.03.8
Multithreading Test35.51.18.30.8821.91.0
All Tests14.32.75.61.99.92.3

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
 OpenJPA
Derby server
Hibernate
H2 server
OpenJPA
Derby server
Hibernate
H2 server
OpenJPA
Derby server
Hibernate
H2 server
Basic Person Test1.52.94.01.82.82.4
Element Collection Test0.00812.61.91.10.941.9
Inheritance Test0.0433.23.82.51.92.9
Indexing Test1.82.96.82.74.32.8
Graph (Binary Tree) Test0.161.20.270.430.220.79
Multithreading Test6.95.65.02.45.94.0
All Tests1.73.13.61.82.72.5

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
 OpenJPA
Derby server
Hibernate
H2 server
OpenJPA
Derby server
Hibernate
H2 server
OpenJPA
Derby server
Hibernate
H2 server
Basic Person Test1.43.83.72.42.53.1
Element Collection Test0.00821.91.41.10.711.5
Inheritance Test0.0353.72.52.51.33.1
Indexing Test2.37.63.53.12.95.3
Graph (Binary Tree) Test0.130.990.350.910.240.95
Multithreading Test3.66.14.07.33.86.7
All Tests1.34.02.62.91.93.5

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
 OpenJPA
Derby server
Hibernate
H2 server
OpenJPA
Derby server
Hibernate
H2 server
OpenJPA
Derby server
Hibernate
H2 server
Basic Person Test7.23.65.52.86.43.2
Element Collection Test0.842.61.51.01.21.8
Inheritance Test1.14.02.93.42.03.7
Indexing Test2.34.67.84.55.14.6
Graph (Binary Tree) Test0.271.50.411.60.341.6
Multithreading Test10.75.28.05.29.45.2
All Tests3.93.74.53.24.23.4

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