Compare with

Comparison of EclipseLink with MySQL server 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
 EclipseLink
MySQL server
Hibernate
H2 embedded
EclipseLink
MySQL server
Hibernate
H2 embedded
EclipseLink
MySQL server
Hibernate
H2 embedded
Basic Person Test3.618.11.59.02.613.5
Element Collection Test1.513.00.696.81.19.9
Inheritance Test3.521.01.49.42.415.2
Indexing Test5.329.92.518.43.924.1
Graph (Binary Tree) Test1.717.21.320.11.518.7
Multithreading Test7.236.92.411.54.824.2
All Tests3.822.61.612.52.717.6

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

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

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

Retrieval Size =>Few EntitiesMany EntitiesAverage Score
 EclipseLink
MySQL server
Hibernate
H2 embedded
EclipseLink
MySQL server
Hibernate
H2 embedded
EclipseLink
MySQL server
Hibernate
H2 embedded
Basic Person Test0.4316.615.513.38.015.0
Element Collection Test0.164.31.44.00.784.1
Inheritance Test0.3910.417.617.59.013.9
Indexing Test0.4310.816.615.28.513.0
Graph (Binary Tree) Test0.532.50.764.00.653.3
Multithreading Test0.1916.211.015.75.615.9
All Tests0.3510.110.511.65.410.9

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

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

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

Retrieval Size =>Few EntitiesMany EntitiesAverage Score
 EclipseLink
MySQL server
Hibernate
H2 embedded
EclipseLink
MySQL server
Hibernate
H2 embedded
EclipseLink
MySQL server
Hibernate
H2 embedded
Basic Person Test1.54.50.441.20.952.8
Element Collection Test1.44.40.431.40.922.9
Inheritance Test1.13.10.611.50.862.3
Indexing Test0.266.60.5210.50.398.6
Multithreading Test1.91.20.720.591.30.89
All Tests1.24.00.543.00.883.5

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

A huge performance gap has been detected when using database indexes with small retrieval size. Comparing the normalized speed of EclipseLink with MySQL database server (0.26) to the normalized speed of Hibernate with H2 embedded database (6.6) reveals that in that case, Hibernate with H2 embedded is 25.4 times faster than EclipseLink with MySQL server.

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

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 EclipseLink
MySQL server
Hibernate
H2 embedded
EclipseLink
MySQL server
Hibernate
H2 embedded
EclipseLink
MySQL server
Hibernate
H2 embedded
Basic Person Test0.3912.11.86.51.19.3
Element Collection Test0.237.41.45.30.836.3
Inheritance Test0.4210.82.68.51.59.6
Indexing Test0.4610.03.17.51.88.8
Graph (Binary Tree) Test0.674.40.412.30.543.4
Multithreading Test0.4816.22.64.01.510.1
All Tests0.4410.12.05.71.27.9

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

A huge performance gap has been detected when using multithreading with small transaction size. Comparing the normalized speed of EclipseLink with MySQL database server (0.48) to the normalized speed of Hibernate with H2 embedded database (16.2) reveals that in that case, Hibernate with H2 embedded is 33.8 times faster than EclipseLink with MySQL server.

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

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 EclipseLink
MySQL server
Hibernate
H2 embedded
EclipseLink
MySQL server
Hibernate
H2 embedded
EclipseLink
MySQL server
Hibernate
H2 embedded
Basic Person Test0.3519.71.711.41.015.5
Element Collection Test0.116.90.514.50.315.7
Inheritance Test0.2915.61.612.90.9414.2
Indexing Test0.4623.21.912.41.217.8
Graph (Binary Tree) Test0.544.00.494.20.514.1
Multithreading Test0.3127.43.622.71.925.0
All Tests0.3416.11.611.40.9813.7

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

A huge performance gap has been detected when using multithreading with small transaction size. Comparing the normalized speed of EclipseLink with MySQL database server (0.31) to the normalized speed of Hibernate with H2 embedded database (27.4) reveals that in that case, Hibernate with H2 embedded is 88.4 times faster than EclipseLink with MySQL server.

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

Transaction/Retrieval SizeFew EntitiesMany EntitiesAverage Score
 EclipseLink
MySQL server
Hibernate
H2 embedded
EclipseLink
MySQL server
Hibernate
H2 embedded
EclipseLink
MySQL server
Hibernate
H2 embedded
Basic Person Test1.314.24.28.32.711.2
Element Collection Test0.697.20.894.40.795.8
Inheritance Test1.112.24.89.92.911.0
Indexing Test1.416.14.912.83.214.5
Graph (Binary Tree) Test0.857.00.737.70.797.3
Multithreading Test2.019.64.010.93.015.2
All Tests1.212.93.39.02.311.0

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

A huge performance gap has been detected when using database indexes with small transaction/retrieval size. Comparing the normalized speed of EclipseLink with MySQL database server (1.4) to the normalized speed of Hibernate with H2 embedded database (16.1) reveals that in that case, Hibernate with H2 embedded is 11.5 times faster than EclipseLink with MySQL server.

Other Head to Head DBMS/JPA Comparisons