Compare with

Comparison of Hibernate with H2 embedded vs EclipseLink with PostgreSQL server

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 embedded
EclipseLink
PostgreSQL server
Hibernate
H2 embedded
EclipseLink
PostgreSQL server
Hibernate
H2 embedded
EclipseLink
PostgreSQL server
Basic Person Test18.17.39.04.213.55.8
Element Collection Test13.03.16.81.99.92.5
Inheritance Test21.06.99.45.015.25.9
Indexing Test29.910.018.46.824.18.4
Graph (Binary Tree) Test17.23.520.13.318.73.4
Multithreading Test36.931.811.514.524.223.1
All Tests22.610.412.56.017.68.2

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

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

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

Retrieval Size =>Few EntitiesMany EntitiesAverage Score
 Hibernate
H2 embedded
EclipseLink
PostgreSQL server
Hibernate
H2 embedded
EclipseLink
PostgreSQL server
Hibernate
H2 embedded
EclipseLink
PostgreSQL server
Basic Person Test16.66.813.317.215.012.0
Element Collection Test4.30.0264.00.0204.10.023
Inheritance Test10.46.017.519.713.912.9
Indexing Test10.85.615.219.513.012.6
Graph (Binary Tree) Test2.50.474.00.613.30.54
Multithreading Test16.213.515.727.815.920.6
All Tests10.15.411.614.110.99.8

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

A huge performance gap has been detected when using JPA element collections with large retrieval size. Comparing the normalized speed of EclipseLink with PostgreSQL database server (0.020) to the normalized speed of Hibernate with H2 embedded database (4.0) reveals that in that case, Hibernate with H2 embedded is 200 times faster than EclipseLink with PostgreSQL server.

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

Retrieval Size =>Few EntitiesMany EntitiesAverage Score
 Hibernate
H2 embedded
EclipseLink
PostgreSQL server
Hibernate
H2 embedded
EclipseLink
PostgreSQL server
Hibernate
H2 embedded
EclipseLink
PostgreSQL server
Basic Person Test4.555.51.27.82.831.6
Element Collection Test4.415.41.40.0282.97.7
Inheritance Test3.154.91.511.52.333.2
Indexing Test6.60.07710.510.08.65.1
Multithreading Test1.255.30.5912.00.8933.7
All Tests4.036.23.08.33.522.3

The results above show that in general EclipseLink with PostgreSQL server 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 EclipseLink with PostgreSQL database server (22.3) reveals that in these tests, EclipseLink with PostgreSQL server is 6.4 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 EclipseLink with PostgreSQL database server (55.3) reveals that in that case, EclipseLink with PostgreSQL server is 46.1 times faster than Hibernate with H2 embedded.

On the other hand, EclipseLink with PostgreSQL server is slower, for instance, when using database indexes with small retrieval size. Comparing the normalized speed of EclipseLink with PostgreSQL database server (0.077) to the normalized speed of Hibernate with H2 embedded database (6.6) reveals that in that case, EclipseLink with PostgreSQL server is 85.7 times slower than Hibernate with H2 embedded.

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

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 Hibernate
H2 embedded
EclipseLink
PostgreSQL server
Hibernate
H2 embedded
EclipseLink
PostgreSQL server
Hibernate
H2 embedded
EclipseLink
PostgreSQL server
Basic Person Test12.16.26.54.19.35.1
Element Collection Test7.40.0805.30.0286.30.054
Inheritance Test10.86.48.56.19.66.2
Indexing Test10.06.57.57.08.86.8
Graph (Binary Tree) Test4.40.902.30.503.40.70
Multithreading Test16.236.04.09.110.122.5
All Tests10.19.35.74.57.96.9

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

A huge performance gap has been detected when using JPA element collections with large transaction size. Comparing the normalized speed of EclipseLink with PostgreSQL database server (0.028) to the normalized speed of Hibernate with H2 embedded database (5.3) reveals that in that case, Hibernate with H2 embedded is 189 times faster than EclipseLink with PostgreSQL server.

On the other hand, Hibernate with H2 embedded is slower, for instance, when using multithreading with large transaction size. Comparing the normalized speed of Hibernate with H2 embedded database (4.0) to the normalized speed of EclipseLink with PostgreSQL database server (9.1) reveals that in that case, Hibernate with H2 embedded is 2.3 times slower than EclipseLink with PostgreSQL server.

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

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 Hibernate
H2 embedded
EclipseLink
PostgreSQL server
Hibernate
H2 embedded
EclipseLink
PostgreSQL server
Hibernate
H2 embedded
EclipseLink
PostgreSQL server
Basic Person Test19.75.711.45.715.55.7
Element Collection Test6.90.0254.5stopped5.70.012
Inheritance Test15.65.512.95.414.25.4
Indexing Test23.210.412.410.017.810.2
Graph (Binary Tree) Test4.00.0164.20.0134.10.015
Multithreading Test27.426.322.716.825.021.6
All Tests16.18.011.46.313.77.2

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

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

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

Transaction/Retrieval SizeFew EntitiesMany EntitiesAverage Score
 Hibernate
H2 embedded
EclipseLink
PostgreSQL server
Hibernate
H2 embedded
EclipseLink
PostgreSQL server
Hibernate
H2 embedded
EclipseLink
PostgreSQL server
Basic Person Test14.216.38.37.811.212.1
Element Collection Test7.23.74.40.405.82.1
Inheritance Test12.215.99.99.511.012.7
Indexing Test16.16.512.810.714.58.6
Graph (Binary Tree) Test7.01.27.71.17.31.2
Multithreading Test19.632.610.916.015.224.3
All Tests12.913.19.07.811.010.5

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

A huge performance gap has been detected when using JPA element collections with large transaction/retrieval size. Comparing the normalized speed of EclipseLink with PostgreSQL database server (0.40) to the normalized speed of Hibernate with H2 embedded database (4.4) reveals that in that case, Hibernate with H2 embedded is 11.0 times faster than EclipseLink with PostgreSQL server.

Other Head to Head DBMS/JPA Comparisons