Compare with

Comparison of Hibernate with H2 server 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
H2 server
DataNucleus
H2 embedded
Hibernate
H2 server
DataNucleus
H2 embedded
Hibernate
H2 server
DataNucleus
H2 embedded
Basic Person Test4.619.23.08.03.813.6
Element Collection Test3.76.61.12.82.44.7
Inheritance Test6.715.63.14.44.910.0
Indexing Test8.224.44.211.86.218.1
Graph (Binary Tree) Test3.49.23.96.23.77.7
Multithreading Test6.834.95.07.15.921.0
All Tests5.618.33.46.74.512.5

The results above show that in general DataNucleus with H2 embedded is more efficient than Hibernate with H2 server in persisting JPA entity objects to the database. Comparing the normalized speed of Hibernate with H2 database server (4.5) to the normalized speed of DataNucleus with H2 embedded database (12.5) reveals that in these tests, DataNucleus with H2 embedded is 2.8 times faster than Hibernate with H2 server.

A large performance gap has been detected when using multithreading with small transaction size. Comparing the normalized speed of Hibernate with H2 database server (6.8) to the normalized speed of DataNucleus with H2 embedded database (34.9) reveals that in that case, DataNucleus with H2 embedded is 5.1 times faster than Hibernate with H2 server.

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

Retrieval Size =>Few EntitiesMany EntitiesAverage Score
 Hibernate
H2 server
DataNucleus
H2 embedded
Hibernate
H2 server
DataNucleus
H2 embedded
Hibernate
H2 server
DataNucleus
H2 embedded
Basic Person Test3.113.26.013.54.613.3
Element Collection Test1.06.41.18.91.07.7
Inheritance Test2.912.27.612.75.212.4
Indexing Test2.68.17.016.54.812.3
Graph (Binary Tree) Test0.4210.61.120.90.7815.8
Multithreading Test6.513.310.59.98.511.6
All Tests2.810.65.613.74.212.2

The results above show that in general DataNucleus with H2 embedded is more efficient than Hibernate with H2 server in retrieving JPA entity objects from the database. Comparing the normalized speed of Hibernate with H2 database server (4.2) to the normalized speed of DataNucleus with H2 embedded database (12.2) reveals that in these tests, DataNucleus with H2 embedded is 2.9 times faster than Hibernate with H2 server.

A huge performance gap has been detected when using graphs of objects with small retrieval size. Comparing the normalized speed of Hibernate with H2 database server (0.42) to the normalized speed of DataNucleus with H2 embedded database (10.6) reveals that in that case, DataNucleus with H2 embedded is 25.2 times faster than Hibernate with H2 server.

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

Retrieval Size =>Few EntitiesMany EntitiesAverage Score
 Hibernate
H2 server
DataNucleus
H2 embedded
Hibernate
H2 server
DataNucleus
H2 embedded
Hibernate
H2 server
DataNucleus
H2 embedded
Basic Person Test3.74.71.01.42.33.1
Element Collection Test3.75.00.632.42.23.7
Inheritance Test3.23.81.41.62.32.7
Indexing Test1.70.00415.81.83.80.91
Multithreading Test1.11.20.880.791.01.0
All Tests2.73.01.91.62.32.3

The results above show that in general Hibernate with H2 server is equivalent to DataNucleus with H2 embedded in executing the tested JPA queries.

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 H2 database server (1.7) reveals that in that case, Hibernate with H2 server is 415 times faster than DataNucleus with H2 embedded.

On the other hand, Hibernate with H2 server is slower, for instance, when using JPA element collections with large retrieval size. Comparing the normalized speed of Hibernate with H2 database server (0.63) to the normalized speed of DataNucleus with H2 embedded database (2.4) reveals that in that case, Hibernate with H2 server is 3.8 times slower than DataNucleus with H2 embedded.

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

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 Hibernate
H2 server
DataNucleus
H2 embedded
Hibernate
H2 server
DataNucleus
H2 embedded
Hibernate
H2 server
DataNucleus
H2 embedded
Basic Person Test2.910.01.83.92.46.9
Element Collection Test2.67.61.13.91.95.8
Inheritance Test3.29.42.54.42.96.9
Indexing Test2.910.62.75.92.88.2
Graph (Binary Tree) Test1.25.90.433.70.794.8
Multithreading Test5.6failed2.4failed4.0failed
All Tests3.18.71.84.42.56.5

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

The results above show that in general DataNucleus with H2 embedded is more efficient than Hibernate with H2 server in updating JPA entity objects in the database. Comparing the normalized speed of Hibernate with H2 database server (2.5) to the normalized speed of DataNucleus with H2 embedded database (6.5) reveals that in these tests, DataNucleus with H2 embedded is 2.6 times faster than Hibernate with H2 server.

A large performance gap has been detected when using graphs of objects with large transaction size. Comparing the normalized speed of Hibernate with H2 database server (0.43) to the normalized speed of DataNucleus with H2 embedded database (3.7) reveals that in that case, DataNucleus with H2 embedded is 8.6 times faster than Hibernate with H2 server.

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

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 Hibernate
H2 server
DataNucleus
H2 embedded
Hibernate
H2 server
DataNucleus
H2 embedded
Hibernate
H2 server
DataNucleus
H2 embedded
Basic Person Test3.84.22.41.33.12.8
Element Collection Test1.94.91.11.61.53.2
Inheritance Test3.74.02.51.33.12.7
Indexing Test7.67.53.11.95.34.7
Graph (Binary Tree) Test0.995.60.914.10.954.8
Multithreading Test6.1failed7.3failed6.7failed
All Tests4.05.22.92.03.53.6

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

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

A large performance gap has been detected when using graphs of objects with small transaction size. Comparing the normalized speed of Hibernate with H2 database server (0.99) to the normalized speed of DataNucleus with H2 embedded database (5.6) reveals that in that case, DataNucleus with H2 embedded is 5.7 times faster than Hibernate with H2 server.

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

Transaction/Retrieval SizeFew EntitiesMany EntitiesAverage Score
 Hibernate
H2 server
DataNucleus
H2 embedded
Hibernate
H2 server
DataNucleus
H2 embedded
Hibernate
H2 server
DataNucleus
H2 embedded
Basic Person Test3.610.32.85.63.27.9
Element Collection Test2.66.11.03.91.85.0
Inheritance Test4.09.03.44.93.76.9
Indexing Test4.610.14.57.64.68.9
Graph (Binary Tree) Test1.57.81.68.71.68.3
Multithreading Test5.216.55.25.95.211.2
All Tests3.79.63.26.03.47.8

The results above show that in general DataNucleus with H2 embedded is more efficient than Hibernate with H2 server in performing JPA database operations. Comparing the normalized speed of Hibernate with H2 database server (3.4) to the normalized speed of DataNucleus with H2 embedded database (7.8) reveals that in these tests, DataNucleus with H2 embedded is 2.3 times faster than Hibernate with H2 server.

A large performance gap has been detected when using graphs of objects with large transaction/retrieval size. Comparing the normalized speed of Hibernate with H2 database server (1.6) to the normalized speed of DataNucleus with H2 embedded database (8.7) reveals that in that case, DataNucleus with H2 embedded is 5.4 times faster than Hibernate with H2 server.

Other Head to Head DBMS/JPA Comparisons