Compare with

Comparison of Hibernate with MySQL server vs EclipseLink 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
EclipseLink
H2 embedded
Hibernate
MySQL server
EclipseLink
H2 embedded
Hibernate
MySQL server
EclipseLink
H2 embedded
Basic Person Test3.625.11.68.92.617.0
Element Collection Test1.620.40.728.01.114.2
Inheritance Test3.728.71.68.72.718.7
Indexing Test5.437.62.614.04.025.8
Graph (Binary Tree) Test1.517.71.214.71.416.2
Multithreading Test7.430.32.911.45.220.8
All Tests3.926.61.810.92.818.8

The results above show that in general EclipseLink 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 EclipseLink with H2 embedded database (18.8) reveals that in these tests, EclipseLink with H2 embedded is 6.7 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 (1.6) to the normalized speed of EclipseLink with H2 embedded database (20.4) reveals that in that case, EclipseLink with H2 embedded is 12.7 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
EclipseLink
H2 embedded
Hibernate
MySQL server
EclipseLink
H2 embedded
Hibernate
MySQL server
EclipseLink
H2 embedded
Basic Person Test3.030.411.029.17.029.7
Element Collection Test0.3419.61.227.60.7923.6
Inheritance Test1.333.814.539.87.936.8
Indexing Test2.522.212.841.37.631.8
Graph (Binary Tree) Test0.5516.00.7120.00.6318.0
Multithreading Test0.2333.713.829.07.031.4
All Tests1.325.99.031.15.228.5

The results above show that in general EclipseLink with H2 embedded is much 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 EclipseLink with H2 embedded database (28.5) reveals that in these tests, EclipseLink with H2 embedded is 5.5 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 EclipseLink with H2 embedded database (33.7) reveals that in that case, EclipseLink with H2 embedded is 147 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
EclipseLink
H2 embedded
Hibernate
MySQL server
EclipseLink
H2 embedded
Hibernate
MySQL server
EclipseLink
H2 embedded
Basic Person Test10.04.42.01.46.02.9
Element Collection Test6.74.10.532.43.63.2
Inheritance Test2.83.41.62.02.22.7
Indexing Test0.4413.02.022.81.217.9
Multithreading Test2.11.00.980.671.50.85
All Tests4.45.21.45.92.95.5

The results above show that in general EclipseLink with H2 embedded is more efficient than Hibernate with MySQL server 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 Hibernate with MySQL database server (0.44) to the normalized speed of EclipseLink with H2 embedded database (13.0) reveals that in that case, EclipseLink with H2 embedded is 29.5 times faster than Hibernate with MySQL server.

On the other hand, EclipseLink with H2 embedded is slower, for instance, when using simple basic entities with small retrieval size. Comparing the normalized speed of EclipseLink with H2 embedded database (4.4) to the normalized speed of Hibernate with MySQL database server (10.0) reveals that in that case, EclipseLink with H2 embedded is 2.3 times slower than Hibernate with MySQL server.

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

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 Hibernate
MySQL server
EclipseLink
H2 embedded
Hibernate
MySQL server
EclipseLink
H2 embedded
Hibernate
MySQL server
EclipseLink
H2 embedded
Basic Person Test0.7316.61.67.61.212.1
Element Collection Test0.3915.31.210.50.7812.9
Inheritance Test0.6115.72.19.81.412.7
Indexing Test0.8112.12.69.91.711.0
Graph (Binary Tree) Test0.6913.70.407.00.5410.3
Multithreading Test0.6320.93.04.21.812.6
All Tests0.6415.71.88.21.212.0

The results above show that in general EclipseLink 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 EclipseLink with H2 embedded database (12.0) reveals that in these tests, EclipseLink with H2 embedded is 10.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.39) to the normalized speed of EclipseLink with H2 embedded database (15.3) reveals that in that case, EclipseLink with H2 embedded is 39.2 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
EclipseLink
H2 embedded
Hibernate
MySQL server
EclipseLink
H2 embedded
Hibernate
MySQL server
EclipseLink
H2 embedded
Basic Person Test1.135.11.719.61.427.4
Element Collection Test0.2119.30.538.50.3713.9
Inheritance Test0.6536.01.814.01.225.0
Indexing Test0.8142.52.019.21.430.9
Graph (Binary Tree) Test0.5512.20.6214.40.5813.3
Multithreading Test0.3554.44.125.82.240.1
All Tests0.6133.31.816.91.225.1

The results above show that in general EclipseLink 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 EclipseLink with H2 embedded database (25.1) reveals that in these tests, EclipseLink with H2 embedded is 20.9 times faster than Hibernate with MySQL server.

A huge performance gap has been detected when using multithreading with small transaction size. Comparing the normalized speed of Hibernate with MySQL database server (0.35) to the normalized speed of EclipseLink with H2 embedded database (54.4) reveals that in that case, EclipseLink with H2 embedded is 155 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
EclipseLink
H2 embedded
Hibernate
MySQL server
EclipseLink
H2 embedded
Hibernate
MySQL server
EclipseLink
H2 embedded
Basic Person Test3.722.33.613.33.617.8
Element Collection Test1.815.70.8411.41.313.6
Inheritance Test1.823.54.314.93.119.2
Indexing Test2.025.54.421.53.223.5
Graph (Binary Tree) Test0.8314.90.7314.00.7814.5
Multithreading Test2.128.15.014.23.621.1
All Tests2.121.93.214.92.718.4

The results above show that in general EclipseLink with H2 embedded is much 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 EclipseLink with H2 embedded database (18.4) reveals that in these tests, EclipseLink with H2 embedded is 6.8 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 EclipseLink with H2 embedded database (14.0) reveals that in that case, EclipseLink with H2 embedded is 19.2 times faster than Hibernate with MySQL server.

Other Head to Head DBMS/JPA Comparisons