Compare with

Comparison of Hibernate with PostgreSQL server vs OpenJPA with Derby 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
PostgreSQL server
OpenJPA
Derby server
Hibernate
PostgreSQL server
OpenJPA
Derby server
Hibernate
PostgreSQL server
OpenJPA
Derby server
Basic Person Test7.13.13.42.75.22.9
Element Collection Test2.92.01.71.72.31.8
Inheritance Test7.03.03.62.35.32.6
Indexing Test9.34.76.14.17.74.4
Graph (Binary Tree) Test3.00.712.90.642.90.67
Multithreading Test31.76.013.93.822.84.9
All Tests10.23.35.32.57.72.9

The results above show that in general Hibernate with PostgreSQL server is more efficient than OpenJPA with Derby server in persisting JPA entity objects to the database. Comparing the normalized speed of OpenJPA with Derby database server (2.9) to the normalized speed of Hibernate with PostgreSQL database server (7.7) reveals that in these tests, Hibernate with PostgreSQL server is 2.7 times faster than OpenJPA with Derby server.

A large performance gap has been detected when using multithreading with small transaction size. Comparing the normalized speed of OpenJPA with Derby database server (6.0) to the normalized speed of Hibernate with PostgreSQL database server (31.7) reveals that in that case, Hibernate with PostgreSQL server is 5.3 times faster than OpenJPA with Derby server.

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

Retrieval Size =>Few EntitiesMany EntitiesAverage Score
 Hibernate
PostgreSQL server
OpenJPA
Derby server
Hibernate
PostgreSQL server
OpenJPA
Derby server
Hibernate
PostgreSQL server
OpenJPA
Derby server
Basic Person Test5.50.7811.511.68.56.2
Element Collection Test0.0250.00240.0171.10.0210.54
Inheritance Test5.20.01414.05.09.62.5
Indexing Test4.60.6213.313.08.96.8
Graph (Binary Tree) Test0.610.0650.780.390.700.23
Multithreading Test11.31.617.019.014.210.3
All Tests4.50.519.48.47.04.4

The results above show that in general Hibernate with PostgreSQL server is more efficient than OpenJPA with Derby server in retrieving JPA entity objects from the database.

A huge performance gap has been detected when using class inheritance in the object model with small retrieval size. Comparing the normalized speed of OpenJPA with Derby database server (0.014) to the normalized speed of Hibernate with PostgreSQL database server (5.2) reveals that in that case, Hibernate with PostgreSQL server is 371 times faster than OpenJPA with Derby server.

On the other hand, Hibernate with PostgreSQL server is slower, for instance, when using JPA element collections with large retrieval size. Comparing the normalized speed of Hibernate with PostgreSQL database server (0.017) to the normalized speed of OpenJPA with Derby database server (1.1) reveals that in that case, Hibernate with PostgreSQL server is 64.7 times slower than OpenJPA with Derby server.

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

Retrieval Size =>Few EntitiesMany EntitiesAverage Score
 Hibernate
PostgreSQL server
OpenJPA
Derby server
Hibernate
PostgreSQL server
OpenJPA
Derby server
Hibernate
PostgreSQL server
OpenJPA
Derby server
Basic Person Test55.529.26.15.530.817.3
Element Collection Test11.02.20.0161.45.51.8
Inheritance Test52.32.28.71.030.51.6
Indexing Test0.0502.28.811.74.47.0
Multithreading Test55.235.59.28.332.221.9
All Tests34.814.36.65.620.79.9

The results above show that in general Hibernate with PostgreSQL server is more efficient than OpenJPA with Derby server in executing the tested JPA queries. Comparing the normalized speed of OpenJPA with Derby database server (9.9) to the normalized speed of Hibernate with PostgreSQL database server (20.7) reveals that in these tests, Hibernate with PostgreSQL server is 2.1 times faster than OpenJPA with Derby server.

A huge performance gap has been detected when using class inheritance in the object model with small retrieval size. Comparing the normalized speed of OpenJPA with Derby database server (2.2) to the normalized speed of Hibernate with PostgreSQL database server (52.3) reveals that in that case, Hibernate with PostgreSQL server is 23.8 times faster than OpenJPA with Derby server.

On the other hand, Hibernate with PostgreSQL server is slower, for instance, when using JPA element collections with large retrieval size. Comparing the normalized speed of Hibernate with PostgreSQL database server (0.016) to the normalized speed of OpenJPA with Derby database server (1.4) reveals that in that case, Hibernate with PostgreSQL server is 87.5 times slower than OpenJPA with Derby server.

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

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 Hibernate
PostgreSQL server
OpenJPA
Derby server
Hibernate
PostgreSQL server
OpenJPA
Derby server
Hibernate
PostgreSQL server
OpenJPA
Derby server
Basic Person Test5.31.52.74.04.02.8
Element Collection Test0.0670.00810.0261.90.0460.94
Inheritance Test5.40.0433.83.84.61.9
Indexing Test5.41.84.36.84.84.3
Graph (Binary Tree) Test1.10.160.580.270.820.22
Multithreading Test29.66.96.35.018.05.9
All Tests7.81.72.93.65.42.7

The results above show that in general Hibernate with PostgreSQL server is more efficient than OpenJPA with Derby server in updating JPA entity objects in the database. Comparing the normalized speed of OpenJPA with Derby database server (2.7) to the normalized speed of Hibernate with PostgreSQL database server (5.4) reveals that in these tests, Hibernate with PostgreSQL server is 2.0 times faster than OpenJPA with Derby server.

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 Derby database server (0.043) to the normalized speed of Hibernate with PostgreSQL database server (5.4) reveals that in that case, Hibernate with PostgreSQL server is 126 times faster than OpenJPA with Derby server.

On the other hand, Hibernate with PostgreSQL server is slower, for instance, when using JPA element collections with large transaction size. Comparing the normalized speed of Hibernate with PostgreSQL database server (0.026) to the normalized speed of OpenJPA with Derby database server (1.9) reveals that in that case, Hibernate with PostgreSQL server is 73.1 times slower than OpenJPA with Derby server.

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

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 Hibernate
PostgreSQL server
OpenJPA
Derby server
Hibernate
PostgreSQL server
OpenJPA
Derby server
Hibernate
PostgreSQL server
OpenJPA
Derby server
Basic Person Test5.31.44.23.74.82.5
Element Collection Test0.0200.0082stopped1.40.00980.71
Inheritance Test5.10.0354.22.54.61.3
Indexing Test9.52.36.33.57.92.9
Graph (Binary Tree) Test0.0120.130.0120.350.0120.24
Multithreading Test23.33.621.84.022.53.8
All Tests7.21.36.12.66.61.9

The results above show that in general Hibernate with PostgreSQL server is much more efficient than OpenJPA with Derby server in deleting JPA entity objects from the database. Comparing the normalized speed of OpenJPA with Derby database server (1.9) to the normalized speed of Hibernate with PostgreSQL database server (6.6) reveals that in these tests, Hibernate with PostgreSQL server is 3.5 times faster than OpenJPA with Derby server.

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 Derby database server (0.035) to the normalized speed of Hibernate with PostgreSQL database server (5.1) reveals that in that case, Hibernate with PostgreSQL server is 146 times faster than OpenJPA with Derby server.

On the other hand, Hibernate with PostgreSQL server is slower, for instance, when using graphs of objects with large transaction size. Comparing the normalized speed of Hibernate with PostgreSQL database server (0.012) to the normalized speed of OpenJPA with Derby database server (0.35) reveals that in that case, Hibernate with PostgreSQL server is 29.2 times slower than OpenJPA with Derby server.

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

Transaction/Retrieval SizeFew EntitiesMany EntitiesAverage Score
 Hibernate
PostgreSQL server
OpenJPA
Derby server
Hibernate
PostgreSQL server
OpenJPA
Derby server
Hibernate
PostgreSQL server
OpenJPA
Derby server
Basic Person Test15.77.25.65.510.76.4
Element Collection Test2.80.840.351.51.61.2
Inheritance Test15.01.16.92.910.92.0
Indexing Test5.82.37.87.86.85.1
Graph (Binary Tree) Test1.20.271.10.411.10.34
Multithreading Test30.210.713.68.021.99.4
All Tests12.13.96.04.59.14.2

The results above show that in general Hibernate with PostgreSQL server is more efficient than OpenJPA with Derby server in performing JPA database operations. Comparing the normalized speed of OpenJPA with Derby database server (4.2) to the normalized speed of Hibernate with PostgreSQL database server (9.1) reveals that in these tests, Hibernate with PostgreSQL server is 2.2 times faster than OpenJPA with Derby server.

A huge 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 Derby database server (1.1) to the normalized speed of Hibernate with PostgreSQL database server (15.0) reveals that in that case, Hibernate with PostgreSQL server is 13.6 times faster than OpenJPA with Derby server.

On the other hand, Hibernate with PostgreSQL server is slower, for instance, when using JPA element collections with large transaction/retrieval size. Comparing the normalized speed of Hibernate with PostgreSQL database server (0.35) to the normalized speed of OpenJPA with Derby database server (1.5) reveals that in that case, Hibernate with PostgreSQL server is 4.3 times slower than OpenJPA with Derby server.

Other Head to Head DBMS/JPA Comparisons