Compare with

Comparison of Hibernate with Derby embedded vs Hibernate 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
Derby embedded
Hibernate
H2 embedded
Hibernate
Derby embedded
Hibernate
H2 embedded
Hibernate
Derby embedded
Hibernate
H2 embedded
Basic Person Test5.918.13.89.04.913.5
Element Collection Test2.913.01.86.82.39.9
Inheritance Test5.321.03.79.44.515.2
Indexing Test7.029.94.818.45.924.1
Graph (Binary Tree) Test1.917.21.720.11.818.7
Multithreading Test10.536.93.711.57.124.2
All Tests5.622.63.312.54.417.6

The results above show that in general Hibernate with H2 embedded is much more efficient than Hibernate with Derby embedded in persisting JPA entity objects to the database. Comparing the normalized speed of Hibernate with Derby embedded database (4.4) to the normalized speed of Hibernate with H2 embedded database (17.6) reveals that in these tests, Hibernate with H2 embedded is 4.0 times faster than Hibernate with Derby embedded.

A huge performance gap has been detected when using graphs of objects with large transaction size. Comparing the normalized speed of Hibernate with Derby embedded database (1.7) to the normalized speed of Hibernate with H2 embedded database (20.1) reveals that in that case, Hibernate with H2 embedded is 11.8 times faster than Hibernate with Derby embedded.

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

Retrieval Size =>Few EntitiesMany EntitiesAverage Score
 Hibernate
Derby embedded
Hibernate
H2 embedded
Hibernate
Derby embedded
Hibernate
H2 embedded
Hibernate
Derby embedded
Hibernate
H2 embedded
Basic Person Test14.216.616.413.315.315.0
Element Collection Test4.44.34.94.04.64.1
Inheritance Test10.310.418.617.514.413.9
Indexing Test10.010.816.415.213.213.0
Graph (Binary Tree) Test2.62.53.04.02.83.3
Multithreading Test19.316.219.315.719.315.9
All Tests10.110.113.111.611.610.9

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

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

Retrieval Size =>Few EntitiesMany EntitiesAverage Score
 Hibernate
Derby embedded
Hibernate
H2 embedded
Hibernate
Derby embedded
Hibernate
H2 embedded
Hibernate
Derby embedded
Hibernate
H2 embedded
Basic Person Test49.34.56.81.228.12.8
Element Collection Test37.64.42.71.420.12.9
Inheritance Test24.13.17.61.515.92.3
Indexing Test5.36.614.810.510.18.6
Multithreading Test39.71.26.10.5922.90.89
All Tests31.24.07.63.019.43.5

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

A huge performance gap has been detected when using multithreading with small retrieval size. Comparing the normalized speed of Hibernate with H2 embedded database (1.2) to the normalized speed of Hibernate with Derby embedded database (39.7) reveals that in that case, Hibernate with Derby embedded is 33.1 times faster than Hibernate with H2 embedded.

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

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 Hibernate
Derby embedded
Hibernate
H2 embedded
Hibernate
Derby embedded
Hibernate
H2 embedded
Hibernate
Derby embedded
Hibernate
H2 embedded
Basic Person Test4.512.13.26.53.89.3
Element Collection Test3.97.43.15.33.56.3
Inheritance Test4.610.84.58.54.59.6
Indexing Test4.610.05.57.55.18.8
Graph (Binary Tree) Test2.74.41.22.32.03.4
Multithreading Test11.616.22.64.07.110.1
All Tests5.310.13.35.74.37.9

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

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

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

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 Hibernate
Derby embedded
Hibernate
H2 embedded
Hibernate
Derby embedded
Hibernate
H2 embedded
Hibernate
Derby embedded
Hibernate
H2 embedded
Basic Person Test3.819.74.211.44.015.5
Element Collection Test2.36.91.54.51.95.7
Inheritance Test4.015.64.312.94.214.2
Indexing Test5.523.23.612.44.617.8
Graph (Binary Tree) Test0.744.00.964.20.854.1
Multithreading Test5.627.44.922.75.325.0
All Tests3.716.13.311.43.513.7

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

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

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

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 Hibernate
Derby embedded
Hibernate
H2 embedded
Hibernate
Derby embedded
Hibernate
H2 embedded
Hibernate
Derby embedded
Hibernate
H2 embedded
Basic Person Test52.727.052.727.052.727.0
Element Collection Test42.330.642.330.642.330.6
Inheritance Test49.227.049.227.049.227.0
Indexing Test53.031.653.932.153.431.9
Graph (Binary Tree) Test13.128.59.821.411.525.0
Multithreading Test49.333.98.89.229.021.5
All Tests43.329.836.124.639.727.2

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

On the other hand, Hibernate with Derby embedded is slower, for instance, when using graphs of objects with large transaction size. Comparing the normalized score of Hibernate with Derby embedded database (9.8) to the normalized score of Hibernate with H2 embedded database (21.4) reveals that in that case, Hibernate with Derby embedded is 2.2 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
Derby embedded
Hibernate
H2 embedded
Hibernate
Derby embedded
Hibernate
H2 embedded
Hibernate
Derby embedded
Hibernate
H2 embedded
Basic Person Test15.514.26.98.311.211.2
Element Collection Test10.27.22.84.46.55.8
Inheritance Test9.712.27.79.98.711.0
Indexing Test6.516.19.012.87.814.5
Graph (Binary Tree) Test2.07.01.77.71.87.3
Multithreading Test17.319.67.310.912.315.2
All Tests10.512.96.19.08.311.0

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

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

Other Head to Head DBMS/JPA Comparisons