Compare with

Comparison of Hibernate with HSQLDB server vs OpenJPA with H2 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
HSQLDB server
OpenJPA
H2 server
Hibernate
HSQLDB server
OpenJPA
H2 server
Hibernate
HSQLDB server
OpenJPA
H2 server
Basic Person Teststopped8.1stopped6.6stopped7.3
Element Collection Teststopped6.4stopped6.9stopped6.7
Inheritance Teststopped4.4stopped7.4stopped5.9
Indexing Teststopped7.2stopped9.4stopped8.3
Graph (Binary Tree) Teststopped2.5stopped2.1stopped2.3
Multithreading Teststopped7.8stopped0.0000stopped3.9
All Testsstopped6.1stopped5.4stopped5.7

The results above show that in general OpenJPA with H2 server 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 database server (5.7) reveals that in these tests, OpenJPA with H2 server 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 server
Hibernate
HSQLDB server
OpenJPA
H2 server
Hibernate
HSQLDB server
OpenJPA
H2 server
Basic Person Teststopped1.7stopped6.1stopped3.9
Element Collection Teststopped0.32stopped6.9stopped3.6
Inheritance Teststopped0.82stopped4.8stopped2.8
Indexing Teststopped1.1stopped9.7stopped5.4
Graph (Binary Tree) Teststopped0.11stopped0.15stopped0.13
Multithreading Teststopped2.2stopped9.6stopped5.9
All Testsstopped1.1stopped6.2stopped3.6

The results above show that in general OpenJPA with H2 server 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 database server (3.6) reveals that in these tests, OpenJPA with H2 server 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 server
Hibernate
HSQLDB server
OpenJPA
H2 server
Hibernate
HSQLDB server
OpenJPA
H2 server
Basic Person Teststopped0.54stopped2.2stopped1.4
Element Collection Teststopped0.53stopped2.0stopped1.3
Inheritance Teststopped0.42stopped2.1stopped1.2
Indexing Teststopped0.78stopped2.6stopped1.7
Multithreading Teststopped2.9stopped4.3stopped3.6
All Testsstopped1.0stopped2.6stopped1.8

The results above show that in general OpenJPA with H2 server 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 database server (1.8) reveals that in these tests, OpenJPA with H2 server 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 server
Hibernate
HSQLDB server
OpenJPA
H2 server
Hibernate
HSQLDB server
OpenJPA
H2 server
Basic Person Teststopped1.1stopped2.1stopped1.6
Element Collection Teststopped1.2stopped3.6stopped2.4
Inheritance Teststopped1.2stopped2.5stopped1.8
Indexing Teststopped3.3stopped2.9stopped3.1
Graph (Binary Tree) Teststopped0.61stopped0.34stopped0.48
Multithreading Teststopped2.7stopped0.76stopped1.8
All Testsstopped1.7stopped2.0stopped1.9

The results above show that in general OpenJPA with H2 server 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 database server (1.9) reveals that in these tests, OpenJPA with H2 server 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 server
Hibernate
HSQLDB server
OpenJPA
H2 server
Hibernate
HSQLDB server
OpenJPA
H2 server
Basic Person Teststopped6.9stopped11.6stopped9.3
Element Collection Teststopped3.5stopped2.2stopped2.9
Inheritance Teststopped8.0stopped5.4stopped6.7
Indexing Teststopped12.2stopped5.8stopped9.0
Graph (Binary Tree) Teststopped7.4stopped10.0stopped8.7
Multithreading Teststopped8.3stopped0.0000stopped4.1
All Testsstopped7.7stopped5.8stopped6.8

The results above show that in general OpenJPA with H2 server 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 database server (6.8) reveals that in these tests, OpenJPA with H2 server 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 server
Hibernate
HSQLDB server
OpenJPA
H2 server
Hibernate
HSQLDB server
OpenJPA
H2 server
Basic Person Teststopped3.7stopped5.7stopped4.7
Element Collection Teststopped2.4stopped4.3stopped3.4
Inheritance Teststopped3.0stopped4.4stopped3.7
Indexing Teststopped4.9stopped6.1stopped5.5
Graph (Binary Tree) Teststopped2.7stopped3.2stopped2.9
Multithreading Teststopped4.8stopped2.9stopped3.9
All Testsstopped3.6stopped4.5stopped4.0

The results above show that in general OpenJPA with H2 server 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 database server (4.0) reveals that in these tests, OpenJPA with H2 server 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 database server (3.7) reveals that in that case, OpenJPA with H2 server is ? times faster than Hibernate with HSQLDB server.

Other Head to Head DBMS/JPA Comparisons