Compare with

Comparison of OpenJPA with H2 embedded vs Hibernate with HSQLDB 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
 OpenJPA
H2 embedded
Hibernate
HSQLDB server
OpenJPA
H2 embedded
Hibernate
HSQLDB server
OpenJPA
H2 embedded
Hibernate
HSQLDB server
Basic Person Test9.7stopped7.7stopped8.7stopped
Element Collection Test10.3stopped7.4stopped8.9stopped
Inheritance Test5.2stopped6.6stopped5.9stopped
Indexing Test9.2stopped8.7stopped9.0stopped
Graph (Binary Tree) Test3.4stopped2.7stopped3.0stopped
Multithreading Test7.5stopped0.0000stopped3.7stopped
All Tests7.5stopped5.5stopped6.5stopped

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

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

Retrieval Size =>Few EntitiesMany EntitiesAverage Score
 OpenJPA
H2 embedded
Hibernate
HSQLDB server
OpenJPA
H2 embedded
Hibernate
HSQLDB server
OpenJPA
H2 embedded
Hibernate
HSQLDB server
Basic Person Test11.4stopped46.6stopped29.0stopped
Element Collection Test1.4stopped33.1stopped17.3stopped
Inheritance Test5.6stopped37.6stopped21.6stopped
Indexing Test5.8stopped39.3stopped22.5stopped
Graph (Binary Tree) Test0.86stopped0.90stopped0.88stopped
Multithreading Test14.0stopped38.9stopped26.4stopped
All Tests6.5stopped32.7stopped19.6stopped

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

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

Retrieval Size =>Few EntitiesMany EntitiesAverage Score
 OpenJPA
H2 embedded
Hibernate
HSQLDB server
OpenJPA
H2 embedded
Hibernate
HSQLDB server
OpenJPA
H2 embedded
Hibernate
HSQLDB server
Basic Person Test5.7stopped24.0stopped14.9stopped
Element Collection Test3.6stopped7.1stopped5.4stopped
Inheritance Test1.1stopped9.3stopped5.2stopped
Indexing Test14.3stopped24.2stopped19.3stopped
Multithreading Test3.1stopped7.2stopped5.1stopped
All Tests5.6stopped14.4stopped10.0stopped

The results above show that in general OpenJPA with H2 embedded is much more efficient than Hibernate with HSQLDB server in executing the tested JPA queries. Comparing the normalized speed of Hibernate with HSQLDB database server (0.0000) to the normalized speed of OpenJPA with H2 embedded database (10.0) reveals that in these tests, OpenJPA with H2 embedded is ? times faster than Hibernate with HSQLDB server.

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

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 OpenJPA
H2 embedded
Hibernate
HSQLDB server
OpenJPA
H2 embedded
Hibernate
HSQLDB server
OpenJPA
H2 embedded
Hibernate
HSQLDB server
Basic Person Test14.2stopped11.2stopped12.7stopped
Element Collection Test6.5stopped15.2stopped10.9stopped
Inheritance Test4.0stopped14.9stopped9.5stopped
Indexing Test43.0stopped16.2stopped29.6stopped
Graph (Binary Tree) Test3.3stopped2.2stopped2.7stopped
Multithreading Test8.2stopped6.3stopped7.2stopped
All Tests13.2stopped11.0stopped12.1stopped

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

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

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 OpenJPA
H2 embedded
Hibernate
HSQLDB server
OpenJPA
H2 embedded
Hibernate
HSQLDB server
OpenJPA
H2 embedded
Hibernate
HSQLDB server
Basic Person Test55.8stopped26.5stopped41.1stopped
Element Collection Test26.3stopped3.0stopped14.6stopped
Inheritance Test26.7stopped23.0stopped24.8stopped
Indexing Test100stopped13.7stopped56.8stopped
Graph (Binary Tree) Test12.5stopped40.6stopped26.5stopped
Multithreading Test20.9stopped0.0000stopped10.4stopped
All Tests40.4stopped17.8stopped29.1stopped

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

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

Transaction/Retrieval SizeFew EntitiesMany EntitiesAverage Score
 OpenJPA
H2 embedded
Hibernate
HSQLDB server
OpenJPA
H2 embedded
Hibernate
HSQLDB server
OpenJPA
H2 embedded
Hibernate
HSQLDB server
Basic Person Test19.4stopped23.2stopped21.3stopped
Element Collection Test9.6stopped13.2stopped11.4stopped
Inheritance Test8.5stopped18.3stopped13.4stopped
Indexing Test34.5stopped20.4stopped27.4stopped
Graph (Binary Tree) Test5.0stopped11.6stopped8.3stopped
Multithreading Test10.7stopped10.5stopped10.6stopped
All Tests14.9stopped16.4stopped15.6stopped

The results above show that in general OpenJPA with H2 embedded is much more efficient than Hibernate with HSQLDB server in performing JPA database operations. Comparing the normalized speed of Hibernate with HSQLDB database server (0.0000) to the normalized speed of OpenJPA with H2 embedded database (15.6) reveals that in these tests, OpenJPA with H2 embedded is ? times faster than Hibernate with HSQLDB server.

A huge performance gap has been detected when using simple basic entities with small transaction/retrieval size. Comparing the normalized speed of Hibernate with HSQLDB database server (0.0000) to the normalized speed of OpenJPA with H2 embedded database (19.4) reveals that in that case, OpenJPA with H2 embedded is ? times faster than Hibernate with HSQLDB server.

Other Head to Head DBMS/JPA Comparisons