Compare with

Comparison of Hibernate with H2 embedded vs DataNucleus 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
 Hibernate
H2 embedded
DataNucleus
HSQLDB embedded
Hibernate
H2 embedded
DataNucleus
HSQLDB embedded
Hibernate
H2 embedded
DataNucleus
HSQLDB embedded
Basic Person Test18.114.29.04.813.59.5
Element Collection Test13.06.66.82.19.94.3
Inheritance Test21.013.69.44.615.29.1
Indexing Test29.924.618.411.124.117.8
Graph (Binary Tree) Test17.26.820.14.518.75.7
Multithreading Test36.938.511.58.524.223.5
All Tests22.617.412.55.917.611.7

The results above show that in general Hibernate with H2 embedded is more efficient than DataNucleus with HSQLDB embedded 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 DataNucleus with HSQLDB embedded database (4.5) to the normalized speed of Hibernate with H2 embedded database (20.1) reveals that in that case, Hibernate with H2 embedded is 4.5 times faster than DataNucleus with HSQLDB embedded.

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

Retrieval Size =>Few EntitiesMany EntitiesAverage Score
 Hibernate
H2 embedded
DataNucleus
HSQLDB embedded
Hibernate
H2 embedded
DataNucleus
HSQLDB embedded
Hibernate
H2 embedded
DataNucleus
HSQLDB embedded
Basic Person Test16.66.613.310.215.08.4
Element Collection Test4.33.64.08.14.15.8
Inheritance Test10.45.717.58.813.97.2
Indexing Test10.85.115.29.513.07.3
Graph (Binary Tree) Test2.57.24.09.33.38.3
Multithreading Test16.28.115.79.515.98.8
All Tests10.16.011.69.210.97.6

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

A large performance gap has been detected when using simple basic entities with small retrieval size. Comparing the normalized speed of DataNucleus with HSQLDB embedded database (6.6) to the normalized speed of Hibernate with H2 embedded database (16.6) reveals that in that case, Hibernate with H2 embedded is 2.5 times faster than DataNucleus with HSQLDB embedded.

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

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

Retrieval Size =>Few EntitiesMany EntitiesAverage Score
 Hibernate
H2 embedded
DataNucleus
HSQLDB embedded
Hibernate
H2 embedded
DataNucleus
HSQLDB embedded
Hibernate
H2 embedded
DataNucleus
HSQLDB embedded
Basic Person Test4.51.41.20.482.80.95
Element Collection Test4.41.31.40.672.91.0
Inheritance Test3.11.61.50.612.31.1
Indexing Test6.60.001610.50.638.60.32
Multithreading Test1.20.400.59failed0.890.40
All Tests4.00.963.00.603.50.80

DataNucleus with HSQLDB embedded has failed in 1 tests (see exceptions).

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

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

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

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 Hibernate
H2 embedded
DataNucleus
HSQLDB embedded
Hibernate
H2 embedded
DataNucleus
HSQLDB embedded
Hibernate
H2 embedded
DataNucleus
HSQLDB embedded
Basic Person Test12.111.56.52.79.37.1
Element Collection Test7.46.95.32.76.34.8
Inheritance Test10.810.38.53.69.66.9
Indexing Test10.011.47.54.48.87.9
Graph (Binary Tree) Test4.43.52.31.53.42.5
Multithreading Test16.2failed4.0failed10.1failed
All Tests10.18.75.73.07.95.8

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

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

A large performance gap has been detected when using simple basic entities with large transaction size. Comparing the normalized speed of DataNucleus with HSQLDB embedded database (2.7) to the normalized speed of Hibernate with H2 embedded database (6.5) reveals that in that case, Hibernate with H2 embedded is 2.4 times faster than DataNucleus with HSQLDB embedded.

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

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 Hibernate
H2 embedded
DataNucleus
HSQLDB embedded
Hibernate
H2 embedded
DataNucleus
HSQLDB embedded
Hibernate
H2 embedded
DataNucleus
HSQLDB embedded
Basic Person Test19.74.211.41.315.52.8
Element Collection Test6.94.94.51.65.73.2
Inheritance Test15.64.012.91.314.22.7
Indexing Test23.27.512.41.917.84.7
Graph (Binary Tree) Test4.02.94.22.04.12.5
Multithreading Test27.440.122.713.725.026.9
All Tests16.110.611.43.713.77.1

The results above show that in general Hibernate with H2 embedded is more efficient than DataNucleus with HSQLDB embedded in deleting JPA entity objects from 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 HSQLDB embedded database (1.3) to the normalized speed of Hibernate with H2 embedded database (12.9) reveals that in that case, Hibernate with H2 embedded is 9.9 times faster than DataNucleus with HSQLDB embedded.

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

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 Hibernate
H2 embedded
DataNucleus
HSQLDB embedded
Hibernate
H2 embedded
DataNucleus
HSQLDB embedded
Hibernate
H2 embedded
DataNucleus
HSQLDB embedded
Basic Person Test27.041.427.041.427.041.4
Element Collection Test30.623.430.623.430.623.4
Inheritance Test27.041.427.041.427.041.4
Indexing Test31.648.432.149.231.948.8
Graph (Binary Tree) Test28.512.521.49.425.010.9
Multithreading Test33.951.99.210.321.531.1
All Tests29.836.524.629.227.232.9

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

On the other hand, DataNucleus with HSQLDB embedded is slower, for instance, when using graphs of objects with small transaction size. Comparing the normalized score of DataNucleus with HSQLDB embedded database (12.5) to the normalized score of Hibernate with H2 embedded database (28.5) reveals that in that case, DataNucleus with HSQLDB embedded is 2.3 times less efficient than Hibernate with H2 embedded.

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

Transaction/Retrieval SizeFew EntitiesMany EntitiesAverage Score
 Hibernate
H2 embedded
DataNucleus
HSQLDB embedded
Hibernate
H2 embedded
DataNucleus
HSQLDB embedded
Hibernate
H2 embedded
DataNucleus
HSQLDB embedded
Basic Person Test14.27.68.33.911.25.7
Element Collection Test7.24.74.43.05.83.8
Inheritance Test12.27.19.93.811.05.4
Indexing Test16.19.712.85.514.57.6
Graph (Binary Tree) Test7.05.17.74.37.34.7
Multithreading Test19.621.810.910.615.217.0
All Tests12.99.09.04.811.07.0

The results above show that in general Hibernate with H2 embedded is more efficient than DataNucleus with HSQLDB 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 HSQLDB embedded database (3.8) to the normalized speed of Hibernate with H2 embedded database (9.9) reveals that in that case, Hibernate with H2 embedded is 2.6 times faster than DataNucleus with HSQLDB embedded.

Other Head to Head DBMS/JPA Comparisons