Compare with

Comparison of DataNucleus with H2 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
 DataNucleus
H2 embedded
Hibernate
HSQLDB embedded
DataNucleus
H2 embedded
Hibernate
HSQLDB embedded
DataNucleus
H2 embedded
Hibernate
HSQLDB embedded
Basic Person Test19.232.68.013.113.622.9
Element Collection Test6.615.12.88.24.711.7
Inheritance Test15.625.54.413.610.019.5
Indexing Test24.429.611.818.818.124.2
Graph (Binary Tree) Test9.213.86.215.67.714.7
Multithreading Test34.937.47.113.021.025.2
All Tests18.325.66.713.712.519.7

The results above show that in general Hibernate with HSQLDB embedded is more efficient than DataNucleus with H2 embedded in persisting JPA entity objects to the database.

A large performance gap has been detected when using class inheritance in the object model with large transaction size. Comparing the normalized speed of DataNucleus with H2 embedded database (4.4) to the normalized speed of Hibernate with HSQLDB embedded database (13.6) reveals that in that case, Hibernate with HSQLDB embedded is 3.1 times faster than DataNucleus with H2 embedded.

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

Retrieval Size =>Few EntitiesMany EntitiesAverage Score
 DataNucleus
H2 embedded
Hibernate
HSQLDB embedded
DataNucleus
H2 embedded
Hibernate
HSQLDB embedded
DataNucleus
H2 embedded
Hibernate
HSQLDB embedded
Basic Person Test13.224.813.516.413.320.6
Element Collection Test6.411.38.910.87.711.0
Inheritance Test12.221.712.721.012.421.3
Indexing Test8.111.916.521.512.316.7
Graph (Binary Tree) Test10.63.620.94.715.84.1
Multithreading Test13.319.89.921.511.620.6
All Tests10.615.513.716.012.215.7

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

A large performance gap has been detected when using multithreading with large retrieval size. Comparing the normalized speed of DataNucleus with H2 embedded database (9.9) to the normalized speed of Hibernate with HSQLDB embedded database (21.5) reveals that in that case, Hibernate with HSQLDB embedded is 2.2 times faster than DataNucleus with H2 embedded.

On the other hand, Hibernate with HSQLDB embedded is slower, for instance, when using graphs of objects with large retrieval size. Comparing the normalized speed of Hibernate with HSQLDB embedded database (4.7) to the normalized speed of DataNucleus with H2 embedded database (20.9) reveals that in that case, Hibernate with HSQLDB embedded is 4.4 times slower than DataNucleus with H2 embedded.

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

Retrieval Size =>Few EntitiesMany EntitiesAverage Score
 DataNucleus
H2 embedded
Hibernate
HSQLDB embedded
DataNucleus
H2 embedded
Hibernate
HSQLDB embedded
DataNucleus
H2 embedded
Hibernate
HSQLDB embedded
Basic Person Test4.73.61.40.883.12.2
Element Collection Test5.03.42.41.73.72.6
Inheritance Test3.82.91.61.02.71.9
Indexing Test0.00419.91.821.70.9115.8
Multithreading Test1.21.10.790.581.00.82
All Tests3.04.21.65.22.34.7

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

A huge performance gap has been detected when using database indexes with small retrieval size. Comparing the normalized speed of DataNucleus with H2 embedded database (0.0041) to the normalized speed of Hibernate with HSQLDB embedded database (9.9) reveals that in that case, Hibernate with HSQLDB embedded is 2,415 times faster than DataNucleus with H2 embedded.

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

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 DataNucleus
H2 embedded
Hibernate
HSQLDB embedded
DataNucleus
H2 embedded
Hibernate
HSQLDB embedded
DataNucleus
H2 embedded
Hibernate
HSQLDB embedded
Basic Person Test10.014.23.95.06.99.6
Element Collection Test7.610.13.95.65.87.8
Inheritance Test9.413.44.47.56.910.5
Indexing Test10.610.75.96.18.28.4
Graph (Binary Tree) Test5.93.73.72.54.83.1
Multithreading Testfailed23.9failed3.8failed13.9
All Tests8.712.74.45.16.58.9

DataNucleus with H2 embedded has failed in 2 tests (see exceptions).

The results above show that in general Hibernate with HSQLDB embedded is more efficient than DataNucleus with H2 embedded in updating JPA entity objects in the database.

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

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 DataNucleus
H2 embedded
Hibernate
HSQLDB embedded
DataNucleus
H2 embedded
Hibernate
HSQLDB embedded
DataNucleus
H2 embedded
Hibernate
HSQLDB embedded
Basic Person Test4.226.11.317.52.821.8
Element Collection Test4.99.11.65.23.27.1
Inheritance Test4.021.41.317.72.719.6
Indexing Test7.533.01.916.34.724.7
Graph (Binary Tree) Test5.65.44.18.24.86.8
Multithreading Testfailed38.5failed28.6failed33.5
All Tests5.222.32.015.63.618.9

DataNucleus with H2 embedded has failed in 2 tests (see exceptions).

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

A huge performance gap has been detected when using class inheritance in the object model with large transaction size. Comparing the normalized speed of DataNucleus with H2 embedded database (1.3) to the normalized speed of Hibernate with HSQLDB embedded database (17.7) reveals that in that case, Hibernate with HSQLDB embedded is 13.6 times faster than DataNucleus with H2 embedded.

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

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 DataNucleus
H2 embedded
Hibernate
HSQLDB embedded
DataNucleus
H2 embedded
Hibernate
HSQLDB embedded
DataNucleus
H2 embedded
Hibernate
HSQLDB embedded
Basic Person Test27.041.427.041.427.041.4
Element Collection Test22.446.922.446.922.446.9
Inheritance Test27.041.427.041.427.041.4
Indexing Test31.648.432.149.231.948.8
Graph (Binary Tree) Test20.028.515.021.417.525.0
Multithreading Test33.951.99.210.321.531.1
All Tests27.043.122.135.124.639.1

The results above show that in general Hibernate with HSQLDB embedded is more efficient than DataNucleus with H2 embedded in using disk space.

A large gap has been detected when using JPA element collections with small transaction size. Comparing the normalized score of DataNucleus with H2 embedded database (22.4) to the normalized score of Hibernate with HSQLDB embedded database (46.9) reveals that in that case, Hibernate with HSQLDB embedded is 2.1 times more efficient than DataNucleus with H2 embedded.

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

Transaction/Retrieval SizeFew EntitiesMany EntitiesAverage Score
 DataNucleus
H2 embedded
Hibernate
HSQLDB embedded
DataNucleus
H2 embedded
Hibernate
HSQLDB embedded
DataNucleus
H2 embedded
Hibernate
HSQLDB embedded
Basic Person Test10.320.25.610.67.915.4
Element Collection Test6.19.83.96.35.08.0
Inheritance Test9.017.04.912.26.914.6
Indexing Test10.119.07.616.98.918.0
Graph (Binary Tree) Test7.86.68.77.88.37.2
Multithreading Test16.524.15.913.511.218.8
All Tests9.616.56.011.37.813.9

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

A large performance gap has been detected when using class inheritance in the object model with large transaction/retrieval size. Comparing the normalized speed of DataNucleus with H2 embedded database (4.9) to the normalized speed of Hibernate with HSQLDB embedded database (12.2) reveals that in that case, Hibernate with HSQLDB embedded is 2.5 times faster than DataNucleus with H2 embedded.

Other Head to Head DBMS/JPA Comparisons