Compare with

Comparison of Hibernate with HSQLDB embedded vs OpenJPA with Derby 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
HSQLDB embedded
OpenJPA
Derby embedded
Hibernate
HSQLDB embedded
OpenJPA
Derby embedded
Hibernate
HSQLDB embedded
OpenJPA
Derby embedded
Basic Person Test32.64.813.12.922.93.9
Element Collection Test15.12.88.21.911.72.4
Inheritance Test25.54.113.62.419.53.3
Indexing Test29.66.118.84.124.25.1
Graph (Binary Tree) Test13.81.515.61.414.71.4
Multithreading Test37.48.713.03.325.26.0
All Tests25.64.713.72.719.73.7

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

A huge performance gap has been detected when using graphs of objects with large transaction size. Comparing the normalized speed of OpenJPA with Derby embedded database (1.4) to the normalized speed of Hibernate with HSQLDB embedded database (15.6) reveals that in that case, Hibernate with HSQLDB embedded is 11.1 times faster than OpenJPA with Derby embedded.

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

Retrieval Size =>Few EntitiesMany EntitiesAverage Score
 Hibernate
HSQLDB embedded
OpenJPA
Derby embedded
Hibernate
HSQLDB embedded
OpenJPA
Derby embedded
Hibernate
HSQLDB embedded
OpenJPA
Derby embedded
Basic Person Test24.814.816.422.620.618.7
Element Collection Test11.30.003110.82.311.01.2
Inheritance Test21.70.01521.07.021.33.5
Indexing Test11.911.721.526.516.719.1
Graph (Binary Tree) Test3.60.934.71.24.11.1
Multithreading Test19.825.221.528.620.626.9
All Tests15.58.816.014.715.711.7

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

A huge performance gap has been detected when using JPA element collections with small retrieval size. Comparing the normalized speed of OpenJPA with Derby embedded database (0.0031) to the normalized speed of Hibernate with HSQLDB embedded database (11.3) reveals that in that case, Hibernate with HSQLDB embedded is 3,645 times faster than OpenJPA with Derby embedded.

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

Retrieval Size =>Few EntitiesMany EntitiesAverage Score
 Hibernate
HSQLDB embedded
OpenJPA
Derby embedded
Hibernate
HSQLDB embedded
OpenJPA
Derby embedded
Hibernate
HSQLDB embedded
OpenJPA
Derby embedded
Basic Person Test3.649.70.889.92.229.8
Element Collection Test3.42.71.79.62.66.1
Inheritance Test2.92.31.01.31.91.8
Indexing Test9.97.021.717.115.812.1
Multithreading Test1.140.90.5811.70.8226.3
All Tests4.220.55.29.94.715.2

The results above show that in general OpenJPA with Derby embedded is much more efficient than Hibernate with HSQLDB embedded in executing the tested JPA queries. Comparing the normalized speed of Hibernate with HSQLDB embedded database (4.7) to the normalized speed of OpenJPA with Derby embedded database (15.2) reveals that in these tests, OpenJPA with Derby embedded is 3.2 times faster than Hibernate with HSQLDB embedded.

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

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

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 Hibernate
HSQLDB embedded
OpenJPA
Derby embedded
Hibernate
HSQLDB embedded
OpenJPA
Derby embedded
Hibernate
HSQLDB embedded
OpenJPA
Derby embedded
Basic Person Test14.25.65.05.29.65.4
Element Collection Test10.10.00905.62.27.81.1
Inheritance Test13.40.0457.54.610.52.3
Indexing Test10.76.16.18.78.47.4
Graph (Binary Tree) Test3.71.62.50.913.11.3
Multithreading Test23.918.33.84.513.911.4
All Tests12.75.35.14.48.94.8

The results above show that in general Hibernate with HSQLDB embedded is more efficient than OpenJPA with Derby embedded 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 Derby embedded database (0.0090) to the normalized speed of Hibernate with HSQLDB embedded database (10.1) reveals that in that case, Hibernate with HSQLDB embedded is 1,122 times faster than OpenJPA with Derby embedded.

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

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 Hibernate
HSQLDB embedded
OpenJPA
Derby embedded
Hibernate
HSQLDB embedded
OpenJPA
Derby embedded
Hibernate
HSQLDB embedded
OpenJPA
Derby embedded
Basic Person Test26.14.217.54.521.84.3
Element Collection Test9.10.00715.21.67.10.80
Inheritance Test21.40.03517.73.019.61.5
Indexing Test33.05.316.33.624.74.4
Graph (Binary Tree) Test5.40.808.20.936.80.86
Multithreading Test38.55.728.66.233.56.0
All Tests22.32.715.63.318.93.0

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

A huge performance gap has been detected when using JPA element collections with small transaction size. Comparing the normalized speed of OpenJPA with Derby embedded database (0.0071) to the normalized speed of Hibernate with HSQLDB embedded database (9.1) reveals that in that case, Hibernate with HSQLDB embedded is 1,282 times faster than OpenJPA with Derby embedded.

Comparison of database storage efficiency (normalized score, higher is better)

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 Hibernate
HSQLDB embedded
OpenJPA
Derby embedded
Hibernate
HSQLDB embedded
OpenJPA
Derby embedded
Hibernate
HSQLDB embedded
OpenJPA
Derby embedded
Basic Person Test41.452.841.452.841.452.8
Element Collection Test46.942.446.942.446.942.4
Inheritance Test41.444.241.444.241.444.2
Indexing Test48.453.149.254.048.853.5
Graph (Binary Tree) Test28.512.821.49.625.011.2
Multithreading Test51.950.710.39.731.130.2
All Tests43.142.735.135.539.139.1

The results above show that in general Hibernate with HSQLDB embedded is equivalent to OpenJPA with Derby embedded in using disk space.

A large gap has been detected when using graphs of objects with large transaction size. Comparing the normalized score of OpenJPA with Derby embedded database (9.6) to the normalized score of Hibernate with HSQLDB embedded database (21.4) reveals that in that case, Hibernate with HSQLDB embedded is 2.2 times more efficient than OpenJPA with Derby embedded.

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

Transaction/Retrieval SizeFew EntitiesMany EntitiesAverage Score
 Hibernate
HSQLDB embedded
OpenJPA
Derby embedded
Hibernate
HSQLDB embedded
OpenJPA
Derby embedded
Hibernate
HSQLDB embedded
OpenJPA
Derby embedded
Basic Person Test20.215.810.69.015.412.4
Element Collection Test9.81.16.33.58.02.3
Inheritance Test17.01.312.23.714.62.5
Indexing Test19.07.216.912.018.09.6
Graph (Binary Tree) Test6.61.27.81.17.21.2
Multithreading Test24.119.813.510.918.815.3
All Tests16.58.011.36.913.97.4

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

A huge performance gap has been detected when using class inheritance in the object model with small transaction/retrieval size. Comparing the normalized speed of OpenJPA with Derby embedded database (1.3) to the normalized speed of Hibernate with HSQLDB embedded database (17.0) reveals that in that case, Hibernate with HSQLDB embedded is 13.1 times faster than OpenJPA with Derby embedded.

Other Head to Head DBMS/JPA Comparisons