Compare with

Comparison of Hibernate with HSQLDB server vs OpenJPA 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
HSQLDB server
OpenJPA
H2 embedded
Hibernate
HSQLDB server
OpenJPA
H2 embedded
Hibernate
HSQLDB server
OpenJPA
H2 embedded
Basic Person Teststopped9.7stopped7.7stopped8.7
Element Collection Teststopped10.3stopped7.4stopped8.9
Inheritance Teststopped5.2stopped6.6stopped5.9
Indexing Teststopped9.2stopped8.7stopped9.0
Graph (Binary Tree) Teststopped3.4stopped2.7stopped3.0
Multithreading Teststopped7.5stopped0.0000stopped3.7
All Testsstopped7.5stopped5.5stopped6.5

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
 Hibernate
HSQLDB server
OpenJPA
H2 embedded
Hibernate
HSQLDB server
OpenJPA
H2 embedded
Hibernate
HSQLDB server
OpenJPA
H2 embedded
Basic Person Teststopped11.4stopped46.6stopped29.0
Element Collection Teststopped1.4stopped33.1stopped17.3
Inheritance Teststopped5.6stopped37.6stopped21.6
Indexing Teststopped5.8stopped39.3stopped22.5
Graph (Binary Tree) Teststopped0.86stopped0.90stopped0.88
Multithreading Teststopped14.0stopped38.9stopped26.4
All Testsstopped6.5stopped32.7stopped19.6

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
 Hibernate
HSQLDB server
OpenJPA
H2 embedded
Hibernate
HSQLDB server
OpenJPA
H2 embedded
Hibernate
HSQLDB server
OpenJPA
H2 embedded
Basic Person Teststopped5.7stopped24.0stopped14.9
Element Collection Teststopped3.6stopped7.1stopped5.4
Inheritance Teststopped1.1stopped9.3stopped5.2
Indexing Teststopped14.3stopped24.2stopped19.3
Multithreading Teststopped3.1stopped7.2stopped5.1
All Testsstopped5.6stopped14.4stopped10.0

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
 Hibernate
HSQLDB server
OpenJPA
H2 embedded
Hibernate
HSQLDB server
OpenJPA
H2 embedded
Hibernate
HSQLDB server
OpenJPA
H2 embedded
Basic Person Teststopped14.2stopped11.2stopped12.7
Element Collection Teststopped6.5stopped15.2stopped10.9
Inheritance Teststopped4.0stopped14.9stopped9.5
Indexing Teststopped43.0stopped16.2stopped29.6
Graph (Binary Tree) Teststopped3.3stopped2.2stopped2.7
Multithreading Teststopped8.2stopped6.3stopped7.2
All Testsstopped13.2stopped11.0stopped12.1

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
 Hibernate
HSQLDB server
OpenJPA
H2 embedded
Hibernate
HSQLDB server
OpenJPA
H2 embedded
Hibernate
HSQLDB server
OpenJPA
H2 embedded
Basic Person Teststopped55.8stopped26.5stopped41.1
Element Collection Teststopped26.3stopped3.0stopped14.6
Inheritance Teststopped26.7stopped23.0stopped24.8
Indexing Teststopped100stopped13.7stopped56.8
Graph (Binary Tree) Teststopped12.5stopped40.6stopped26.5
Multithreading Teststopped20.9stopped0.0000stopped10.4
All Testsstopped40.4stopped17.8stopped29.1

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
 Hibernate
HSQLDB server
OpenJPA
H2 embedded
Hibernate
HSQLDB server
OpenJPA
H2 embedded
Hibernate
HSQLDB server
OpenJPA
H2 embedded
Basic Person Teststopped19.4stopped23.2stopped21.3
Element Collection Teststopped9.6stopped13.2stopped11.4
Inheritance Teststopped8.5stopped18.3stopped13.4
Indexing Teststopped34.5stopped20.4stopped27.4
Graph (Binary Tree) Teststopped5.0stopped11.6stopped8.3
Multithreading Teststopped10.7stopped10.5stopped10.6
All Testsstopped14.9stopped16.4stopped15.6

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