Comparison of OpenJPA with PostgreSQL server 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 PostgreSQL server | Hibernate H2 embedded | OpenJPA PostgreSQL server | Hibernate H2 embedded | OpenJPA PostgreSQL server | Hibernate H2 embedded |
Basic Person Test | 5.2 | 18.1 | 4.8 | 9.0 | 5.0 | 13.5 |
Element Collection Test | 2.8 | 13.0 | 2.2 | 6.8 | 2.5 | 9.9 |
Inheritance Test | 4.6 | 21.0 | 3.2 | 9.4 | 3.9 | 15.2 |
Indexing Test | 7.4 | 29.9 | 6.9 | 18.4 | 7.1 | 24.1 |
Graph (Binary Tree) Test | 0.98 | 17.2 | 0.81 | 20.1 | 0.89 | 18.7 |
Multithreading Test | 23.4 | 36.9 | 9.1 | 11.5 | 16.2 | 24.2 |
All Tests | 7.4 | 22.6 | 4.5 | 12.5 | 5.9 | 17.6 |
The results above show that in general Hibernate with H2 embedded is more efficient than OpenJPA with PostgreSQL server in persisting JPA entity objects to the database. Comparing the normalized speed of OpenJPA with PostgreSQL database server (5.9) to the normalized speed of Hibernate with H2 embedded database (17.6) reveals that in these tests, Hibernate with H2 embedded is 3.0 times faster than OpenJPA with PostgreSQL server.
A huge performance gap has been detected when using graphs of objects with large transaction size. Comparing the normalized speed of OpenJPA with PostgreSQL database server (0.81) to the normalized speed of Hibernate with H2 embedded database (20.1) reveals that in that case, Hibernate with H2 embedded is 24.8 times faster than OpenJPA with PostgreSQL server.
Speed comparison of JPA database retrieval operations (normalized score, higher is better)
Retrieval Size => | Few Entities | Many Entities | Average Score | |||
---|---|---|---|---|---|---|
  | OpenJPA PostgreSQL server | Hibernate H2 embedded | OpenJPA PostgreSQL server | Hibernate H2 embedded | OpenJPA PostgreSQL server | Hibernate H2 embedded |
Basic Person Test | 5.8 | 16.6 | 16.1 | 13.3 | 10.9 | 15.0 |
Element Collection Test | 0.013 | 4.3 | 8.7 | 4.0 | 4.4 | 4.1 |
Inheritance Test | 5.2 | 10.4 | 17.6 | 17.5 | 11.4 | 13.9 |
Indexing Test | 4.8 | 10.8 | 18.7 | 15.2 | 11.8 | 13.0 |
Graph (Binary Tree) Test | 0.27 | 2.5 | 0.35 | 4.0 | 0.31 | 3.3 |
Multithreading Test | 11.9 | 16.2 | 23.3 | 15.7 | 17.6 | 15.9 |
All Tests | 4.7 | 10.1 | 14.1 | 11.6 | 9.4 | 10.9 |
The results above show that in general Hibernate with H2 embedded is slightly more efficient than OpenJPA with PostgreSQL server in retrieving JPA entity objects from the database.
A huge performance gap has been detected when using JPA element collections with small retrieval size. Comparing the normalized speed of OpenJPA with PostgreSQL database server (0.013) to the normalized speed of Hibernate with H2 embedded database (4.3) reveals that in that case, Hibernate with H2 embedded is 331 times faster than OpenJPA with PostgreSQL server.
On the other hand, Hibernate with H2 embedded is slower, for instance, when using JPA element collections with large retrieval size. Comparing the normalized speed of Hibernate with H2 embedded database (4.0) to the normalized speed of OpenJPA with PostgreSQL database server (8.7) reveals that in that case, Hibernate with H2 embedded is 2.2 times slower than OpenJPA with PostgreSQL server.
Speed comparison of JPA database query operations (normalized score, higher is better)
Retrieval Size => | Few Entities | Many Entities | Average Score | |||
---|---|---|---|---|---|---|
  | OpenJPA PostgreSQL server | Hibernate H2 embedded | OpenJPA PostgreSQL server | Hibernate H2 embedded | OpenJPA PostgreSQL server | Hibernate H2 embedded |
Basic Person Test | failed | 4.5 | failed | 1.2 | failed | 2.8 |
Element Collection Test | failed | 4.4 | failed | 1.4 | failed | 2.9 |
Inheritance Test | failed | 3.1 | failed | 1.5 | failed | 2.3 |
Indexing Test | failed | 6.6 | failed | 10.5 | failed | 8.6 |
Multithreading Test | failed | 1.2 | failed | 0.59 | failed | 0.89 |
All Tests | failed | 4.0 | failed | 3.0 | failed | 3.5 |
OpenJPA with PostgreSQL server has failed in 10 tests (see exceptions).
Speed comparison of JPA database update operations (normalized score, higher is better)
Transaction Size => | Few Entities | Many Entities | Average Score | |||
---|---|---|---|---|---|---|
  | OpenJPA PostgreSQL server | Hibernate H2 embedded | OpenJPA PostgreSQL server | Hibernate H2 embedded | OpenJPA PostgreSQL server | Hibernate H2 embedded |
Basic Person Test | 4.9 | 12.1 | 3.9 | 6.5 | 4.4 | 9.3 |
Element Collection Test | 0.033 | 7.4 | 4.6 | 5.3 | 2.3 | 6.3 |
Inheritance Test | 4.8 | 10.8 | 4.9 | 8.5 | 4.9 | 9.6 |
Indexing Test | 5.1 | 10.0 | 6.0 | 7.5 | 5.6 | 8.8 |
Graph (Binary Tree) Test | 0.57 | 4.4 | 0.31 | 2.3 | 0.44 | 3.4 |
Multithreading Test | 22.2 | 16.2 | 7.4 | 4.0 | 14.8 | 10.1 |
All Tests | 6.3 | 10.1 | 4.5 | 5.7 | 5.4 | 7.9 |
The results above show that in general Hibernate with H2 embedded is more efficient than OpenJPA with PostgreSQL server in updating JPA entity objects in the database.
A huge performance gap has been detected when using JPA element collections with small transaction size. Comparing the normalized speed of OpenJPA with PostgreSQL database server (0.033) to the normalized speed of Hibernate with H2 embedded database (7.4) reveals that in that case, Hibernate with H2 embedded is 224 times faster than OpenJPA with PostgreSQL server.
Speed comparison of JPA database removal operations (normalized score, higher is better)
Transaction Size => | Few Entities | Many Entities | Average Score | |||
---|---|---|---|---|---|---|
  | OpenJPA PostgreSQL server | Hibernate H2 embedded | OpenJPA PostgreSQL server | Hibernate H2 embedded | OpenJPA PostgreSQL server | Hibernate H2 embedded |
Basic Person Test | 4.6 | 19.7 | 5.3 | 11.4 | 5.0 | 15.5 |
Element Collection Test | 0.032 | 6.9 | 2.8 | 4.5 | 1.4 | 5.7 |
Inheritance Test | 4.3 | 15.6 | 4.6 | 12.9 | 4.4 | 14.2 |
Indexing Test | 8.0 | 23.2 | 7.1 | 12.4 | 7.5 | 17.8 |
Graph (Binary Tree) Test | 0.53 | 4.0 | 0.55 | 4.2 | 0.54 | 4.1 |
Multithreading Test | 17.4 | 27.4 | 9.1 | 22.7 | 13.3 | 25.0 |
All Tests | 5.8 | 16.1 | 4.9 | 11.4 | 5.4 | 13.7 |
The results above show that in general Hibernate with H2 embedded is more efficient than OpenJPA with PostgreSQL server in deleting JPA entity objects from the database. Comparing the normalized speed of OpenJPA with PostgreSQL database server (5.4) to the normalized speed of Hibernate with H2 embedded database (13.7) reveals that in these tests, Hibernate with H2 embedded is 2.5 times faster than OpenJPA with PostgreSQL server.
A huge performance gap has been detected when using JPA element collections with small transaction size. Comparing the normalized speed of OpenJPA with PostgreSQL database server (0.032) to the normalized speed of Hibernate with H2 embedded database (6.9) reveals that in that case, Hibernate with H2 embedded is 216 times faster than OpenJPA with PostgreSQL server.
Comparison of JPA/Database speed - the averages (normalized score, higher is better)
Transaction/Retrieval Size | Few Entities | Many Entities | Average Score | |||
---|---|---|---|---|---|---|
  | OpenJPA PostgreSQL server | Hibernate H2 embedded | OpenJPA PostgreSQL server | Hibernate H2 embedded | OpenJPA PostgreSQL server | Hibernate H2 embedded |
Basic Person Test | 5.1 | 14.2 | 7.5 | 8.3 | 6.3 | 11.2 |
Element Collection Test | 0.72 | 7.2 | 4.6 | 4.4 | 2.6 | 5.8 |
Inheritance Test | 4.7 | 12.2 | 7.6 | 9.9 | 6.2 | 11.0 |
Indexing Test | 6.3 | 16.1 | 9.7 | 12.8 | 8.0 | 14.5 |
Graph (Binary Tree) Test | 0.59 | 7.0 | 0.50 | 7.7 | 0.55 | 7.3 |
Multithreading Test | 18.7 | 19.6 | 12.2 | 10.9 | 15.5 | 15.2 |
All Tests | 6.0 | 12.9 | 7.0 | 9.0 | 6.5 | 11.0 |
The results above show that in general Hibernate with H2 embedded is more efficient than OpenJPA with PostgreSQL server in performing JPA database operations.
A huge performance gap has been detected when using graphs of objects with large transaction/retrieval size. Comparing the normalized speed of OpenJPA with PostgreSQL database server (0.50) to the normalized speed of Hibernate with H2 embedded database (7.7) reveals that in that case, Hibernate with H2 embedded is 15.4 times faster than OpenJPA with PostgreSQL server.
Other Head to Head DBMS/JPA Comparisons
OpenJPA with PostgreSQL server 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 HSQLDB embedded
- OpenJPA with Derby server
- OpenJPA with H2 server
- OpenJPA with MySQL 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