Compare with

Comparison of Hibernate with HSQLDB embedded vs DataNucleus 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
HSQLDB embedded
DataNucleus
H2 embedded
Hibernate
HSQLDB embedded
DataNucleus
H2 embedded
Hibernate
HSQLDB embedded
DataNucleus
H2 embedded
Basic Person Test32.619.213.18.022.913.6
Element Collection Test15.16.68.22.811.74.7
Inheritance Test25.515.613.64.419.510.0
Indexing Test29.624.418.811.824.218.1
Graph (Binary Tree) Test13.89.215.66.214.77.7
Multithreading Test37.434.913.07.125.221.0
All Tests25.618.313.76.719.712.5

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
 Hibernate
HSQLDB embedded
DataNucleus
H2 embedded
Hibernate
HSQLDB embedded
DataNucleus
H2 embedded
Hibernate
HSQLDB embedded
DataNucleus
H2 embedded
Basic Person Test24.813.216.413.520.613.3
Element Collection Test11.36.410.88.911.07.7
Inheritance Test21.712.221.012.721.312.4
Indexing Test11.98.121.516.516.712.3
Graph (Binary Tree) Test3.610.64.720.94.115.8
Multithreading Test19.813.321.59.920.611.6
All Tests15.510.616.013.715.712.2

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
 Hibernate
HSQLDB embedded
DataNucleus
H2 embedded
Hibernate
HSQLDB embedded
DataNucleus
H2 embedded
Hibernate
HSQLDB embedded
DataNucleus
H2 embedded
Basic Person Test3.64.70.881.42.23.1
Element Collection Test3.45.01.72.42.63.7
Inheritance Test2.93.81.01.61.92.7
Indexing Test9.90.004121.71.815.80.91
Multithreading Test1.11.20.580.790.821.0
All Tests4.23.05.21.64.72.3

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
 Hibernate
HSQLDB embedded
DataNucleus
H2 embedded
Hibernate
HSQLDB embedded
DataNucleus
H2 embedded
Hibernate
HSQLDB embedded
DataNucleus
H2 embedded
Basic Person Test14.210.05.03.99.66.9
Element Collection Test10.17.65.63.97.85.8
Inheritance Test13.49.47.54.410.56.9
Indexing Test10.710.66.15.98.48.2
Graph (Binary Tree) Test3.75.92.53.73.14.8
Multithreading Test23.9failed3.8failed13.9failed
All Tests12.78.75.14.48.96.5

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
 Hibernate
HSQLDB embedded
DataNucleus
H2 embedded
Hibernate
HSQLDB embedded
DataNucleus
H2 embedded
Hibernate
HSQLDB embedded
DataNucleus
H2 embedded
Basic Person Test26.14.217.51.321.82.8
Element Collection Test9.14.95.21.67.13.2
Inheritance Test21.44.017.71.319.62.7
Indexing Test33.07.516.31.924.74.7
Graph (Binary Tree) Test5.45.68.24.16.84.8
Multithreading Test38.5failed28.6failed33.5failed
All Tests22.35.215.62.018.93.6

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
 Hibernate
HSQLDB embedded
DataNucleus
H2 embedded
Hibernate
HSQLDB embedded
DataNucleus
H2 embedded
Hibernate
HSQLDB embedded
DataNucleus
H2 embedded
Basic Person Test41.427.041.427.041.427.0
Element Collection Test46.922.446.922.446.922.4
Inheritance Test41.427.041.427.041.427.0
Indexing Test48.431.649.232.148.831.9
Graph (Binary Tree) Test28.520.021.415.025.017.5
Multithreading Test51.933.910.39.231.121.5
All Tests43.127.035.122.139.124.6

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
 Hibernate
HSQLDB embedded
DataNucleus
H2 embedded
Hibernate
HSQLDB embedded
DataNucleus
H2 embedded
Hibernate
HSQLDB embedded
DataNucleus
H2 embedded
Basic Person Test20.210.310.65.615.47.9
Element Collection Test9.86.16.33.98.05.0
Inheritance Test17.09.012.24.914.66.9
Indexing Test19.010.116.97.618.08.9
Graph (Binary Tree) Test6.67.87.88.77.28.3
Multithreading Test24.116.513.55.918.811.2
All Tests16.59.611.36.013.97.8

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