Compare with

Comparison of Hibernate with MySQL 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
MySQL server
DataNucleus
H2 embedded
Hibernate
MySQL server
DataNucleus
H2 embedded
Hibernate
MySQL server
DataNucleus
H2 embedded
Basic Person Test3.619.21.68.02.613.6
Element Collection Test1.66.60.722.81.14.7
Inheritance Test3.715.61.64.42.710.0
Indexing Test5.424.42.611.84.018.1
Graph (Binary Tree) Test1.59.21.26.21.47.7
Multithreading Test7.434.92.97.15.221.0
All Tests3.918.31.86.72.812.5

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

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

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

Retrieval Size =>Few EntitiesMany EntitiesAverage Score
 Hibernate
MySQL server
DataNucleus
H2 embedded
Hibernate
MySQL server
DataNucleus
H2 embedded
Hibernate
MySQL server
DataNucleus
H2 embedded
Basic Person Test3.013.211.013.57.013.3
Element Collection Test0.346.41.28.90.797.7
Inheritance Test1.312.214.512.77.912.4
Indexing Test2.58.112.816.57.612.3
Graph (Binary Tree) Test0.5510.60.7120.90.6315.8
Multithreading Test0.2313.313.89.97.011.6
All Tests1.310.69.013.75.212.2

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

A huge performance gap has been detected when using multithreading with small retrieval size. Comparing the normalized speed of Hibernate with MySQL database server (0.23) to the normalized speed of DataNucleus with H2 embedded database (13.3) reveals that in that case, DataNucleus with H2 embedded is 57.8 times faster than Hibernate with MySQL server.

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

Retrieval Size =>Few EntitiesMany EntitiesAverage Score
 Hibernate
MySQL server
DataNucleus
H2 embedded
Hibernate
MySQL server
DataNucleus
H2 embedded
Hibernate
MySQL server
DataNucleus
H2 embedded
Basic Person Test10.04.72.01.46.03.1
Element Collection Test6.75.00.532.43.63.7
Inheritance Test2.83.81.61.62.22.7
Indexing Test0.440.00412.01.81.20.91
Multithreading Test2.11.20.980.791.51.0
All Tests4.43.01.41.62.92.3

The results above show that in general Hibernate with MySQL server is slightly more efficient than 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 MySQL database server (0.44) reveals that in that case, Hibernate with MySQL server is 107 times faster than DataNucleus with H2 embedded.

On the other hand, Hibernate with MySQL server is slower, for instance, when using JPA element collections with large retrieval size. Comparing the normalized speed of Hibernate with MySQL database server (0.53) to the normalized speed of DataNucleus with H2 embedded database (2.4) reveals that in that case, Hibernate with MySQL server is 4.5 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
MySQL server
DataNucleus
H2 embedded
Hibernate
MySQL server
DataNucleus
H2 embedded
Hibernate
MySQL server
DataNucleus
H2 embedded
Basic Person Test0.7310.01.63.91.26.9
Element Collection Test0.397.61.23.90.785.8
Inheritance Test0.619.42.14.41.46.9
Indexing Test0.8110.62.65.91.78.2
Graph (Binary Tree) Test0.695.90.403.70.544.8
Multithreading Test0.63failed3.0failed1.8failed
All Tests0.648.71.84.41.26.5

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

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

A huge performance gap has been detected when using JPA element collections with small transaction size. Comparing the normalized speed of Hibernate with MySQL database server (0.39) to the normalized speed of DataNucleus with H2 embedded database (7.6) reveals that in that case, DataNucleus with H2 embedded is 19.5 times faster than Hibernate with MySQL server.

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

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 Hibernate
MySQL server
DataNucleus
H2 embedded
Hibernate
MySQL server
DataNucleus
H2 embedded
Hibernate
MySQL server
DataNucleus
H2 embedded
Basic Person Test1.14.21.71.31.42.8
Element Collection Test0.214.90.531.60.373.2
Inheritance Test0.654.01.81.31.22.7
Indexing Test0.817.52.01.91.44.7
Graph (Binary Tree) Test0.555.60.624.10.584.8
Multithreading Test0.35failed4.1failed2.2failed
All Tests0.615.21.82.01.23.6

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

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

A huge performance gap has been detected when using JPA element collections with small transaction size. Comparing the normalized speed of Hibernate with MySQL database server (0.21) to the normalized speed of DataNucleus with H2 embedded database (4.9) reveals that in that case, DataNucleus with H2 embedded is 23.3 times faster than Hibernate with MySQL server.

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

Transaction/Retrieval SizeFew EntitiesMany EntitiesAverage Score
 Hibernate
MySQL server
DataNucleus
H2 embedded
Hibernate
MySQL server
DataNucleus
H2 embedded
Hibernate
MySQL server
DataNucleus
H2 embedded
Basic Person Test3.710.33.65.63.67.9
Element Collection Test1.86.10.843.91.35.0
Inheritance Test1.89.04.34.93.16.9
Indexing Test2.010.14.47.63.28.9
Graph (Binary Tree) Test0.837.80.738.70.788.3
Multithreading Test2.116.55.05.93.611.2
All Tests2.19.63.26.02.77.8

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

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

Other Head to Head DBMS/JPA Comparisons