Compare with

Comparison of Hibernate with Derby embedded vs OpenJPA 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
 Hibernate
Derby embedded
OpenJPA
H2 server
Hibernate
Derby embedded
OpenJPA
H2 server
Hibernate
Derby embedded
OpenJPA
H2 server
Basic Person Test5.93.73.82.24.92.9
Element Collection Test2.92.61.81.52.32.1
Inheritance Test5.34.53.72.04.53.2
Indexing Test7.07.34.83.65.95.4
Graph (Binary Tree) Test1.91.11.70.841.80.97
Multithreading Test10.57.73.74.27.15.9
All Tests5.64.53.32.44.43.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
 Hibernate
Derby embedded
OpenJPA
H2 server
Hibernate
Derby embedded
OpenJPA
H2 server
Hibernate
Derby embedded
OpenJPA
H2 server
Basic Person Test14.22.916.47.615.35.2
Element Collection Test4.40.00224.91.94.60.93
Inheritance Test10.30.01318.64.014.42.0
Indexing Test10.04.116.48.813.26.5
Graph (Binary Tree) Test2.60.383.00.492.80.44
Multithreading Test19.35.919.314.019.310.0
All Tests10.12.213.16.111.64.2

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
 Hibernate
Derby embedded
OpenJPA
H2 server
Hibernate
Derby embedded
OpenJPA
H2 server
Hibernate
Derby embedded
OpenJPA
H2 server
Basic Person Test49.33.76.81.028.12.4
Element Collection Test37.62.02.71.220.11.6
Inheritance Test24.12.87.61.115.92.0
Indexing Test5.33.814.87.510.15.7
Multithreading Test39.70.986.11.022.91.0
All Tests31.22.77.62.419.42.5

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
 Hibernate
Derby embedded
OpenJPA
H2 server
Hibernate
Derby embedded
OpenJPA
H2 server
Hibernate
Derby embedded
OpenJPA
H2 server
Basic Person Test4.53.03.22.03.82.5
Element Collection Test3.90.00783.11.93.50.94
Inheritance Test4.60.0344.52.84.51.4
Indexing Test4.62.85.53.25.13.0
Graph (Binary Tree) Test2.70.791.20.432.00.61
Multithreading Test11.67.02.62.57.14.8
All Tests5.32.33.32.14.32.2

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
 Hibernate
Derby embedded
OpenJPA
H2 server
Hibernate
Derby embedded
OpenJPA
H2 server
Hibernate
Derby embedded
OpenJPA
H2 server
Basic Person Test3.83.24.22.24.02.7
Element Collection Test2.30.00601.50.881.90.44
Inheritance Test4.00.0304.33.14.21.6
Indexing Test5.56.53.63.64.65.1
Graph (Binary Tree) Test0.740.730.960.750.850.74
Multithreading Test5.67.64.95.25.36.4
All Tests3.73.03.32.63.52.8

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
 Hibernate
Derby embedded
OpenJPA
H2 server
Hibernate
Derby embedded
OpenJPA
H2 server
Hibernate
Derby embedded
OpenJPA
H2 server
Basic Person Test15.53.36.93.011.23.1
Element Collection Test10.20.932.81.56.51.2
Inheritance Test9.71.57.72.68.72.0
Indexing Test6.54.99.05.47.85.1
Graph (Binary Tree) Test2.00.751.70.631.80.69
Multithreading Test17.35.97.35.412.35.6
All Tests10.52.96.13.28.33.0

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