Compare with

Comparison of Hibernate with Derby server vs OpenJPA with H2 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
 Hibernate
Derby server
OpenJPA
H2 embedded
Hibernate
Derby server
OpenJPA
H2 embedded
Hibernate
Derby server
OpenJPA
H2 embedded
Basic Person Test3.817.13.05.83.411.5
Element Collection Test2.010.91.34.91.77.9
Inheritance Test3.414.33.05.93.210.1
Indexing Test4.824.44.113.74.419.1
Graph (Binary Tree) Test1.86.81.66.71.76.7
Multithreading Test6.934.23.910.25.422.2
All Tests3.817.92.87.93.312.9

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
 Hibernate
Derby server
OpenJPA
H2 embedded
Hibernate
Derby server
OpenJPA
H2 embedded
Hibernate
Derby server
OpenJPA
H2 embedded
Basic Person Test3.814.68.427.26.120.9
Element Collection Test1.00.00461.04.31.02.1
Inheritance Test3.50.0119.77.46.63.7
Indexing Test3.217.09.535.06.426.0
Graph (Binary Tree) Test0.911.01.21.41.11.2
Multithreading Test7.818.713.427.610.623.1
All Tests3.48.67.217.15.312.8

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
 Hibernate
Derby server
OpenJPA
H2 embedded
Hibernate
Derby server
OpenJPA
H2 embedded
Hibernate
Derby server
OpenJPA
H2 embedded
Basic Person Test34.05.04.11.119.13.1
Element Collection Test33.81.70.641.317.21.5
Inheritance Test20.52.25.01.212.81.7
Indexing Test2.013.89.223.25.618.5
Multithreading Test36.21.45.10.6020.60.99
All Tests25.34.84.85.515.15.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
 Hibernate
Derby server
OpenJPA
H2 embedded
Hibernate
Derby server
OpenJPA
H2 embedded
Hibernate
Derby server
OpenJPA
H2 embedded
Basic Person Test2.910.02.56.02.78.0
Element Collection Test2.30.0111.53.81.91.9
Inheritance Test2.90.0463.55.03.22.5
Indexing Test3.08.94.27.03.68.0
Graph (Binary Tree) Test1.22.40.581.30.911.9
Multithreading Test6.816.62.54.34.610.4
All Tests3.26.32.54.62.85.4

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
 Hibernate
Derby server
OpenJPA
H2 embedded
Hibernate
Derby server
OpenJPA
H2 embedded
Hibernate
Derby server
OpenJPA
H2 embedded
Basic Person Test2.918.33.511.13.214.7
Element Collection Test1.70.0120.872.91.31.4
Inheritance Test2.90.0303.66.63.23.3
Indexing Test3.723.23.69.73.716.4
Graph (Binary Tree) Test0.691.80.702.40.702.1
Multithreading Test6.231.25.117.35.624.2
All Tests3.012.42.98.33.010.4

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
 Hibernate
Derby server
OpenJPA
H2 embedded
Hibernate
Derby server
OpenJPA
H2 embedded
Hibernate
Derby server
OpenJPA
H2 embedded
Basic Person Test9.513.04.310.26.911.6
Element Collection Test8.22.51.13.44.63.0
Inheritance Test6.63.35.05.25.84.3
Indexing Test3.317.56.117.74.717.6
Graph (Binary Tree) Test1.23.01.03.01.13.0
Multithreading Test12.820.46.012.09.416.2
All Tests7.110.24.08.85.69.5

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