Compare with

Comparison of OpenJPA with Derby embedded vs Hibernate with HSQLDB 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
 OpenJPA
Derby embedded
Hibernate
HSQLDB embedded
OpenJPA
Derby embedded
Hibernate
HSQLDB embedded
OpenJPA
Derby embedded
Hibernate
HSQLDB embedded
Basic Person Test4.832.62.913.13.922.9
Element Collection Test2.815.11.98.22.411.7
Inheritance Test4.125.52.413.63.319.5
Indexing Test6.129.64.118.85.124.2
Graph (Binary Tree) Test1.513.81.415.61.414.7
Multithreading Test8.737.43.313.06.025.2
All Tests4.725.62.713.73.719.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
 OpenJPA
Derby embedded
Hibernate
HSQLDB embedded
OpenJPA
Derby embedded
Hibernate
HSQLDB embedded
OpenJPA
Derby embedded
Hibernate
HSQLDB embedded
Basic Person Test14.824.822.616.418.720.6
Element Collection Test0.003111.32.310.81.211.0
Inheritance Test0.01521.77.021.03.521.3
Indexing Test11.711.926.521.519.116.7
Graph (Binary Tree) Test0.933.61.24.71.14.1
Multithreading Test25.219.828.621.526.920.6
All Tests8.815.514.716.011.715.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
 OpenJPA
Derby embedded
Hibernate
HSQLDB embedded
OpenJPA
Derby embedded
Hibernate
HSQLDB embedded
OpenJPA
Derby embedded
Hibernate
HSQLDB embedded
Basic Person Test49.73.69.90.8829.82.2
Element Collection Test2.73.49.61.76.12.6
Inheritance Test2.32.91.31.01.81.9
Indexing Test7.09.917.121.712.115.8
Multithreading Test40.91.111.70.5826.30.82
All Tests20.54.29.95.215.24.7

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
 OpenJPA
Derby embedded
Hibernate
HSQLDB embedded
OpenJPA
Derby embedded
Hibernate
HSQLDB embedded
OpenJPA
Derby embedded
Hibernate
HSQLDB embedded
Basic Person Test5.614.25.25.05.49.6
Element Collection Test0.009010.12.25.61.17.8
Inheritance Test0.04513.44.67.52.310.5
Indexing Test6.110.78.76.17.48.4
Graph (Binary Tree) Test1.63.70.912.51.33.1
Multithreading Test18.323.94.53.811.413.9
All Tests5.312.74.45.14.88.9

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
 OpenJPA
Derby embedded
Hibernate
HSQLDB embedded
OpenJPA
Derby embedded
Hibernate
HSQLDB embedded
OpenJPA
Derby embedded
Hibernate
HSQLDB embedded
Basic Person Test4.226.14.517.54.321.8
Element Collection Test0.00719.11.65.20.807.1
Inheritance Test0.03521.43.017.71.519.6
Indexing Test5.333.03.616.34.424.7
Graph (Binary Tree) Test0.805.40.938.20.866.8
Multithreading Test5.738.56.228.66.033.5
All Tests2.722.33.315.63.018.9

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
 OpenJPA
Derby embedded
Hibernate
HSQLDB embedded
OpenJPA
Derby embedded
Hibernate
HSQLDB embedded
OpenJPA
Derby embedded
Hibernate
HSQLDB embedded
Basic Person Test52.841.452.841.452.841.4
Element Collection Test42.446.942.446.942.446.9
Inheritance Test44.241.444.241.444.241.4
Indexing Test53.148.454.049.253.548.8
Graph (Binary Tree) Test12.828.59.621.411.225.0
Multithreading Test50.751.99.710.330.231.1
All Tests42.743.135.535.139.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
 OpenJPA
Derby embedded
Hibernate
HSQLDB embedded
OpenJPA
Derby embedded
Hibernate
HSQLDB embedded
OpenJPA
Derby embedded
Hibernate
HSQLDB embedded
Basic Person Test15.820.29.010.612.415.4
Element Collection Test1.19.83.56.32.38.0
Inheritance Test1.317.03.712.22.514.6
Indexing Test7.219.012.016.99.618.0
Graph (Binary Tree) Test1.26.61.17.81.27.2
Multithreading Test19.824.110.913.515.318.8
All Tests8.016.56.911.37.413.9

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