Comparison of OpenJPA with HSQLDB embedded vs Hibernate 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 Entities | Many Entities | Average Score | |||
---|---|---|---|---|---|---|
  | OpenJPA HSQLDB embedded | Hibernate H2 embedded | OpenJPA HSQLDB embedded | Hibernate H2 embedded | OpenJPA HSQLDB embedded | Hibernate H2 embedded |
Basic Person Test | 13.3 | 18.1 | 6.9 | 9.0 | 10.1 | 13.5 |
Element Collection Test | 8.6 | 13.0 | 5.3 | 6.8 | 7.0 | 9.9 |
Inheritance Test | 12.2 | 21.0 | 5.8 | 9.4 | 9.0 | 15.2 |
Indexing Test | 16.7 | 29.9 | 9.1 | 18.4 | 12.9 | 24.1 |
Graph (Binary Tree) Test | 6.1 | 17.2 | 7.3 | 20.1 | 6.7 | 18.7 |
Multithreading Test | 26.8 | 36.9 | 7.0 | 11.5 | 16.9 | 24.2 |
All Tests | 13.9 | 22.6 | 6.9 | 12.5 | 10.4 | 17.6 |
The results above show that in general Hibernate with H2 embedded is more efficient than OpenJPA with HSQLDB embedded in persisting JPA entity objects to the database.
A large performance gap has been detected when using graphs of objects with small transaction size. Comparing the normalized speed of OpenJPA with HSQLDB embedded database (6.1) to the normalized speed of Hibernate with H2 embedded database (17.2) reveals that in that case, Hibernate with H2 embedded is 2.8 times faster than OpenJPA with HSQLDB embedded.
Speed comparison of JPA database retrieval operations (normalized score, higher is better)
Retrieval Size => | Few Entities | Many Entities | Average Score | |||
---|---|---|---|---|---|---|
  | OpenJPA HSQLDB embedded | Hibernate H2 embedded | OpenJPA HSQLDB embedded | Hibernate H2 embedded | OpenJPA HSQLDB embedded | Hibernate H2 embedded |
Basic Person Test | 21.8 | 16.6 | 30.1 | 13.3 | 25.9 | 15.0 |
Element Collection Test | 0.0068 | 4.3 | 4.5 | 4.0 | 2.2 | 4.1 |
Inheritance Test | 0.0025 | 10.4 | 2.0 | 17.5 | 0.98 | 13.9 |
Indexing Test | 22.1 | 10.8 | 43.6 | 15.2 | 32.9 | 13.0 |
Graph (Binary Tree) Test | 2.1 | 2.5 | 2.1 | 4.0 | 2.1 | 3.3 |
Multithreading Test | 20.9 | 16.2 | 23.5 | 15.7 | 22.2 | 15.9 |
All Tests | 11.1 | 10.1 | 17.6 | 11.6 | 14.4 | 10.9 |
The results above show that in general OpenJPA with HSQLDB embedded is more efficient than Hibernate with H2 embedded in retrieving JPA entity objects from the database.
A large performance gap has been detected when using database indexes with large retrieval size. Comparing the normalized speed of Hibernate with H2 embedded database (15.2) to the normalized speed of OpenJPA with HSQLDB embedded database (43.6) reveals that in that case, OpenJPA with HSQLDB embedded is 2.9 times faster than Hibernate with H2 embedded.
On the other hand, OpenJPA with HSQLDB embedded is slower, for instance, when using class inheritance in the object model with small retrieval size. Comparing the normalized speed of OpenJPA with HSQLDB embedded database (0.0025) to the normalized speed of Hibernate with H2 embedded database (10.4) reveals that in that case, OpenJPA with HSQLDB embedded is 4,160 times slower than Hibernate with H2 embedded.
Speed comparison of JPA database query operations (normalized score, higher is better)
Retrieval Size => | Few Entities | Many Entities | Average Score | |||
---|---|---|---|---|---|---|
  | OpenJPA HSQLDB embedded | Hibernate H2 embedded | OpenJPA HSQLDB embedded | Hibernate H2 embedded | OpenJPA HSQLDB embedded | Hibernate H2 embedded |
Basic Person Test | 2.8 | 4.5 | 0.91 | 1.2 | 1.9 | 2.8 |
Element Collection Test | 1.4 | 4.4 | 0.95 | 1.4 | 1.2 | 2.9 |
Inheritance Test | 2.4 | 3.1 | 1.3 | 1.5 | 1.8 | 2.3 |
Indexing Test | 15.4 | 6.6 | 34.3 | 10.5 | 24.9 | 8.6 |
Multithreading Test | 1.4 | 1.2 | 0.53 | 0.59 | 0.95 | 0.89 |
All Tests | 4.7 | 4.0 | 7.6 | 3.0 | 6.1 | 3.5 |
The results above show that in general OpenJPA with HSQLDB embedded is more efficient than Hibernate with H2 embedded in executing the tested JPA queries.
A large performance gap has been detected when using database indexes with large retrieval size. Comparing the normalized speed of Hibernate with H2 embedded database (10.5) to the normalized speed of OpenJPA with HSQLDB embedded database (34.3) reveals that in that case, OpenJPA with HSQLDB embedded is 3.3 times faster than Hibernate with H2 embedded.
On the other hand, OpenJPA with HSQLDB embedded is slower, for instance, when using JPA element collections with small retrieval size. Comparing the normalized speed of OpenJPA with HSQLDB embedded database (1.4) to the normalized speed of Hibernate with H2 embedded database (4.4) reveals that in that case, OpenJPA with HSQLDB embedded is 3.1 times slower than Hibernate with H2 embedded.
Speed comparison of JPA database update operations (normalized score, higher is better)
Transaction Size => | Few Entities | Many Entities | Average Score | |||
---|---|---|---|---|---|---|
  | OpenJPA HSQLDB embedded | Hibernate H2 embedded | OpenJPA HSQLDB embedded | Hibernate H2 embedded | OpenJPA HSQLDB embedded | Hibernate H2 embedded |
Basic Person Test | 12.0 | 12.1 | 5.3 | 6.5 | 8.6 | 9.3 |
Element Collection Test | 0.017 | 7.4 | 3.7 | 5.3 | 1.8 | 6.3 |
Inheritance Test | 0.0098 | 10.8 | 2.0 | 8.5 | 0.99 | 9.6 |
Indexing Test | 9.3 | 10.0 | 5.5 | 7.5 | 7.4 | 8.8 |
Graph (Binary Tree) Test | 2.5 | 4.4 | 1.6 | 2.3 | 2.1 | 3.4 |
Multithreading Test | 20.0 | 16.2 | 3.7 | 4.0 | 11.8 | 10.1 |
All Tests | 7.3 | 10.1 | 3.6 | 5.7 | 5.5 | 7.9 |
The results above show that in general Hibernate with H2 embedded is more efficient than OpenJPA with HSQLDB embedded in updating JPA entity objects in the database.
A huge performance gap has been detected when using class inheritance in the object model with small transaction size. Comparing the normalized speed of OpenJPA with HSQLDB embedded database (0.0098) to the normalized speed of Hibernate with H2 embedded database (10.8) reveals that in that case, Hibernate with H2 embedded is 1,102 times faster than OpenJPA with HSQLDB embedded.
Speed comparison of JPA database removal operations (normalized score, higher is better)
Transaction Size => | Few Entities | Many Entities | Average Score | |||
---|---|---|---|---|---|---|
  | OpenJPA HSQLDB embedded | Hibernate H2 embedded | OpenJPA HSQLDB embedded | Hibernate H2 embedded | OpenJPA HSQLDB embedded | Hibernate H2 embedded |
Basic Person Test | 21.3 | 19.7 | 15.7 | 11.4 | 18.5 | 15.5 |
Element Collection Test | 0.011 | 6.9 | 2.9 | 4.5 | 1.5 | 5.7 |
Inheritance Test | 0.0070 | 15.6 | 3.5 | 12.9 | 1.8 | 14.2 |
Indexing Test | 28.8 | 23.2 | 15.2 | 12.4 | 22.0 | 17.8 |
Graph (Binary Tree) Test | 2.9 | 4.0 | 3.6 | 4.2 | 3.2 | 4.1 |
Multithreading Test | 26.0 | 27.4 | 19.6 | 22.7 | 22.8 | 25.0 |
All Tests | 13.2 | 16.1 | 10.1 | 11.4 | 11.6 | 13.7 |
The results above show that in general Hibernate with H2 embedded is slightly more efficient than OpenJPA with HSQLDB embedded in deleting JPA entity objects from the database.
A huge performance gap has been detected when using class inheritance in the object model with small transaction size. Comparing the normalized speed of OpenJPA with HSQLDB embedded database (0.0070) to the normalized speed of Hibernate with H2 embedded database (15.6) reveals that in that case, Hibernate with H2 embedded is 2,229 times faster than OpenJPA with HSQLDB embedded.
Comparison of database storage efficiency (normalized score, higher is better)
Transaction Size => | Few Entities | Many Entities | Average Score | |||
---|---|---|---|---|---|---|
  | OpenJPA HSQLDB embedded | Hibernate H2 embedded | OpenJPA HSQLDB embedded | Hibernate H2 embedded | OpenJPA HSQLDB embedded | Hibernate H2 embedded |
Basic Person Test | 41.4 | 27.0 | 41.4 | 27.0 | 41.4 | 27.0 |
Element Collection Test | 46.9 | 30.6 | 46.9 | 30.6 | 46.9 | 30.6 |
Inheritance Test | 41.4 | 27.0 | 41.4 | 27.0 | 41.4 | 27.0 |
Indexing Test | 48.4 | 31.6 | 49.2 | 32.1 | 48.8 | 31.9 |
Graph (Binary Tree) Test | 28.5 | 28.5 | 21.4 | 21.4 | 25.0 | 25.0 |
Multithreading Test | 51.9 | 33.9 | 10.3 | 9.2 | 31.1 | 21.5 |
All Tests | 43.1 | 29.8 | 35.1 | 24.6 | 39.1 | 27.2 |
The results above show that in general OpenJPA with HSQLDB embedded is more efficient than Hibernate with H2 embedded in using disk space.
Comparison of JPA/Database speed - the averages (normalized score, higher is better)
Transaction/Retrieval Size | Few Entities | Many Entities | Average Score | |||
---|---|---|---|---|---|---|
  | OpenJPA HSQLDB embedded | Hibernate H2 embedded | OpenJPA HSQLDB embedded | Hibernate H2 embedded | OpenJPA HSQLDB embedded | Hibernate H2 embedded |
Basic Person Test | 14.3 | 14.2 | 11.8 | 8.3 | 13.0 | 11.2 |
Element Collection Test | 2.0 | 7.2 | 3.5 | 4.4 | 2.7 | 5.8 |
Inheritance Test | 2.9 | 12.2 | 2.9 | 9.9 | 2.9 | 11.0 |
Indexing Test | 18.5 | 16.1 | 21.6 | 12.8 | 20.0 | 14.5 |
Graph (Binary Tree) Test | 3.4 | 7.0 | 3.7 | 7.7 | 3.5 | 7.3 |
Multithreading Test | 19.0 | 19.6 | 10.9 | 10.9 | 14.9 | 15.2 |
All Tests | 10.2 | 12.9 | 9.2 | 9.0 | 9.7 | 11.0 |
The results above show that in general Hibernate with H2 embedded is slightly more efficient than OpenJPA with HSQLDB embedded in performing JPA database operations.
A large performance gap has been detected when using class inheritance in the object model with small transaction/retrieval size. Comparing the normalized speed of OpenJPA with HSQLDB embedded database (2.9) to the normalized speed of Hibernate with H2 embedded database (12.2) reveals that in that case, Hibernate with H2 embedded is 4.2 times faster than OpenJPA with HSQLDB embedded.
Other Head to Head DBMS/JPA Comparisons
OpenJPA with HSQLDB embedded against:
- Oracle Database 11g
- IBM DB2 10
- Microsoft SQL Server 2008
- DataNucleus with Derby embedded
- DataNucleus with H2 embedded
- DataNucleus with HSQLDB embedded
- DataNucleus with DB4O embedded
- DataNucleus with Derby server
- DataNucleus with H2 server
- DataNucleus with MySQL server
- DataNucleus with PostgreSQL server
- EclipseLink with Derby embedded
- EclipseLink with H2 embedded
- EclipseLink with HSQLDB embedded
- EclipseLink with SQLite embedded
- EclipseLink with Derby server
- EclipseLink with H2 server
- EclipseLink with MySQL server
- EclipseLink with PostgreSQL server
- Hibernate with Derby embedded
- Hibernate with H2 embedded
- Hibernate with HSQLDB embedded
- Hibernate with SQLite embedded
- Hibernate with Derby server
- Hibernate with H2 server
- Hibernate with MySQL server
- Hibernate with PostgreSQL server
- OpenJPA with Derby embedded
- OpenJPA with H2 embedded
- OpenJPA with Derby server
- OpenJPA with H2 server
- OpenJPA with MySQL server
- OpenJPA with PostgreSQL server
- ObjectDB embedded
- ObjectDB server
Hibernate with H2 embedded against:
- Oracle Database 11g
- IBM DB2 10
- Microsoft SQL Server 2008
- DataNucleus with Derby embedded
- DataNucleus with H2 embedded
- DataNucleus with HSQLDB embedded
- DataNucleus with DB4O embedded
- DataNucleus with Derby server
- DataNucleus with H2 server
- DataNucleus with MySQL server
- DataNucleus with PostgreSQL server
- EclipseLink with Derby embedded
- EclipseLink with H2 embedded
- EclipseLink with HSQLDB embedded
- EclipseLink with SQLite embedded
- EclipseLink with Derby server
- EclipseLink with H2 server
- EclipseLink with MySQL server
- EclipseLink with PostgreSQL server
- Hibernate with Derby embedded
- Hibernate with HSQLDB embedded
- Hibernate with SQLite embedded
- Hibernate with Derby server
- Hibernate with H2 server
- Hibernate with MySQL server
- Hibernate with PostgreSQL server
- OpenJPA with Derby embedded
- OpenJPA with H2 embedded
- OpenJPA with HSQLDB embedded
- OpenJPA with Derby server
- OpenJPA with H2 server
- OpenJPA with MySQL server
- OpenJPA with PostgreSQL server
- ObjectDB embedded
- ObjectDB server