Compare with

Comparison of OpenJPA with MySQL server vs Hibernate with HSQLDB 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
 OpenJPA
MySQL server
Hibernate
HSQLDB embedded
OpenJPA
MySQL server
Hibernate
HSQLDB embedded
OpenJPA
MySQL server
Hibernate
HSQLDB embedded
Basic Person Test3.932.61.613.12.722.9
Element Collection Test1.615.10.688.21.111.7
Inheritance Test3.625.51.413.62.519.5
Indexing Test5.629.62.418.84.024.2
Graph (Binary Tree) Test0.6813.80.5715.60.6314.7
Multithreading Test7.237.42.713.04.925.2
All Tests3.725.61.513.72.619.7

The results above show that in general Hibernate with HSQLDB embedded is much more efficient than OpenJPA with MySQL server in persisting JPA entity objects to the database. Comparing the normalized speed of OpenJPA with MySQL database server (2.6) to the normalized speed of Hibernate with HSQLDB embedded database (19.7) reveals that in these tests, Hibernate with HSQLDB embedded is 7.6 times faster than OpenJPA with MySQL server.

A huge performance gap has been detected when using graphs of objects with large transaction size. Comparing the normalized speed of OpenJPA with MySQL database server (0.57) to the normalized speed of Hibernate with HSQLDB embedded database (15.6) reveals that in that case, Hibernate with HSQLDB embedded is 27.4 times faster than OpenJPA with MySQL server.

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

Retrieval Size =>Few EntitiesMany EntitiesAverage Score
 OpenJPA
MySQL server
Hibernate
HSQLDB embedded
OpenJPA
MySQL server
Hibernate
HSQLDB embedded
OpenJPA
MySQL server
Hibernate
HSQLDB embedded
Basic Person Test3.224.822.716.412.920.6
Element Collection Test0.003811.32.910.81.411.0
Inheritance Test0.01721.76.921.03.421.3
Indexing Test2.411.923.421.512.916.7
Graph (Binary Tree) Test0.273.60.354.70.314.1
Multithreading Test0.1419.818.121.59.120.6
All Tests1.015.512.416.06.715.7

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

A huge performance gap has been detected when using JPA element collections with small retrieval size. Comparing the normalized speed of OpenJPA with MySQL database server (0.0038) to the normalized speed of Hibernate with HSQLDB embedded database (11.3) reveals that in that case, Hibernate with HSQLDB embedded is 2,974 times faster than OpenJPA with MySQL server.

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

Retrieval Size =>Few EntitiesMany EntitiesAverage Score
 OpenJPA
MySQL server
Hibernate
HSQLDB embedded
OpenJPA
MySQL server
Hibernate
HSQLDB embedded
OpenJPA
MySQL server
Hibernate
HSQLDB embedded
Basic Person Test9.33.62.20.885.82.2
Element Collection Test4.83.41.11.72.92.6
Inheritance Test1.52.90.901.01.21.9
Indexing Test0.319.92.121.71.215.8
Multithreading Test1.91.10.990.581.40.82
All Tests3.64.21.55.22.54.7

The results above show that in general Hibernate with HSQLDB embedded is more efficient than OpenJPA 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 OpenJPA with MySQL database server (0.31) to the normalized speed of Hibernate with HSQLDB embedded database (9.9) reveals that in that case, Hibernate with HSQLDB embedded is 31.9 times faster than OpenJPA with MySQL server.

On the other hand, Hibernate with HSQLDB embedded is slower, for instance, when using simple basic entities with small retrieval size. Comparing the normalized speed of Hibernate with HSQLDB embedded database (3.6) to the normalized speed of OpenJPA with MySQL database server (9.3) reveals that in that case, Hibernate with HSQLDB embedded is 2.6 times slower than OpenJPA with MySQL server.

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

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 OpenJPA
MySQL server
Hibernate
HSQLDB embedded
OpenJPA
MySQL server
Hibernate
HSQLDB embedded
OpenJPA
MySQL server
Hibernate
HSQLDB embedded
Basic Person Test0.7414.21.65.01.29.6
Element Collection Test0.01410.11.75.60.877.8
Inheritance Test0.04813.42.07.51.010.5
Indexing Test0.7410.73.06.11.98.4
Graph (Binary Tree) Test0.453.70.252.50.353.1
Multithreading Test0.5523.92.93.81.713.9
All Tests0.4212.71.95.11.28.9

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

A huge performance gap has been detected when using JPA element collections with small transaction size. Comparing the normalized speed of OpenJPA with MySQL database server (0.014) to the normalized speed of Hibernate with HSQLDB embedded database (10.1) reveals that in that case, Hibernate with HSQLDB embedded is 721 times faster than OpenJPA with MySQL server.

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

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 OpenJPA
MySQL server
Hibernate
HSQLDB embedded
OpenJPA
MySQL server
Hibernate
HSQLDB embedded
OpenJPA
MySQL server
Hibernate
HSQLDB embedded
Basic Person Test0.9826.11.717.51.421.8
Element Collection Test0.00999.10.655.20.337.1
Inheritance Test0.03321.41.517.70.7519.6
Indexing Test0.6433.02.016.31.324.7
Graph (Binary Tree) Test0.415.40.438.20.426.8
Multithreading Test0.2738.52.928.61.633.5
All Tests0.3922.31.515.60.9618.9

The results above show that in general Hibernate with HSQLDB embedded is much more efficient than OpenJPA with MySQL server in deleting JPA entity objects from the database. Comparing the normalized speed of OpenJPA with MySQL database server (0.96) to the normalized speed of Hibernate with HSQLDB embedded database (18.9) reveals that in these tests, Hibernate with HSQLDB embedded is 19.7 times faster than OpenJPA with MySQL server.

A huge performance gap has been detected when using JPA element collections with small transaction size. Comparing the normalized speed of OpenJPA with MySQL database server (0.0099) to the normalized speed of Hibernate with HSQLDB embedded database (9.1) reveals that in that case, Hibernate with HSQLDB embedded is 919 times faster than OpenJPA with MySQL server.

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

Transaction/Retrieval SizeFew EntitiesMany EntitiesAverage Score
 OpenJPA
MySQL server
Hibernate
HSQLDB embedded
OpenJPA
MySQL server
Hibernate
HSQLDB embedded
OpenJPA
MySQL server
Hibernate
HSQLDB embedded
Basic Person Test3.620.26.010.64.815.4
Element Collection Test1.39.81.46.31.38.0
Inheritance Test1.017.02.512.21.814.6
Indexing Test1.919.06.616.94.318.0
Graph (Binary Tree) Test0.456.60.407.80.437.2
Multithreading Test2.024.15.513.53.818.8
All Tests1.816.53.911.32.813.9

The results above show that in general Hibernate with HSQLDB embedded is much more efficient than OpenJPA with MySQL server in performing JPA database operations. Comparing the normalized speed of OpenJPA with MySQL database server (2.8) to the normalized speed of Hibernate with HSQLDB embedded database (13.9) reveals that in these tests, Hibernate with HSQLDB embedded is 5.0 times faster than OpenJPA 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 OpenJPA with MySQL database server (0.40) to the normalized speed of Hibernate with HSQLDB embedded database (7.8) reveals that in that case, Hibernate with HSQLDB embedded is 19.5 times faster than OpenJPA with MySQL server.

Other Head to Head DBMS/JPA Comparisons