Compare with

Comparison of Hibernate with PostgreSQL server vs OpenJPA with Derby 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
PostgreSQL server
OpenJPA
Derby embedded
Hibernate
PostgreSQL server
OpenJPA
Derby embedded
Hibernate
PostgreSQL server
OpenJPA
Derby embedded
Basic Person Test7.14.83.42.95.23.9
Element Collection Test2.92.81.71.92.32.4
Inheritance Test7.04.13.62.45.33.3
Indexing Test9.36.16.14.17.75.1
Graph (Binary Tree) Test3.01.52.91.42.91.4
Multithreading Test31.78.713.93.322.86.0
All Tests10.24.75.32.77.73.7

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

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

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

Retrieval Size =>Few EntitiesMany EntitiesAverage Score
 Hibernate
PostgreSQL server
OpenJPA
Derby embedded
Hibernate
PostgreSQL server
OpenJPA
Derby embedded
Hibernate
PostgreSQL server
OpenJPA
Derby embedded
Basic Person Test5.514.811.522.68.518.7
Element Collection Test0.0250.00310.0172.30.0211.2
Inheritance Test5.20.01514.07.09.63.5
Indexing Test4.611.713.326.58.919.1
Graph (Binary Tree) Test0.610.930.781.20.701.1
Multithreading Test11.325.217.028.614.226.9
All Tests4.58.89.414.77.011.7

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

A huge performance gap has been detected 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 embedded database (2.3) reveals that in that case, OpenJPA with Derby embedded is 135 times faster than Hibernate with PostgreSQL server.

On the other hand, OpenJPA with Derby embedded is slower, for instance, when using class inheritance in the object model with small retrieval size. Comparing the normalized speed of OpenJPA with Derby embedded database (0.015) to the normalized speed of Hibernate with PostgreSQL database server (5.2) reveals that in that case, OpenJPA with Derby embedded is 347 times slower than Hibernate with PostgreSQL server.

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

Retrieval Size =>Few EntitiesMany EntitiesAverage Score
 Hibernate
PostgreSQL server
OpenJPA
Derby embedded
Hibernate
PostgreSQL server
OpenJPA
Derby embedded
Hibernate
PostgreSQL server
OpenJPA
Derby embedded
Basic Person Test55.549.76.19.930.829.8
Element Collection Test11.02.70.0169.65.56.1
Inheritance Test52.32.38.71.330.51.8
Indexing Test0.0507.08.817.14.412.1
Multithreading Test55.240.99.211.732.226.3
All Tests34.820.56.69.920.715.2

The results above show that in general Hibernate with PostgreSQL server is more efficient than OpenJPA with Derby embedded in executing the tested JPA queries.

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

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 embedded database (9.6) reveals that in that case, Hibernate with PostgreSQL server is 600 times slower than OpenJPA with Derby embedded.

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

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 Hibernate
PostgreSQL server
OpenJPA
Derby embedded
Hibernate
PostgreSQL server
OpenJPA
Derby embedded
Hibernate
PostgreSQL server
OpenJPA
Derby embedded
Basic Person Test5.35.62.75.24.05.4
Element Collection Test0.0670.00900.0262.20.0461.1
Inheritance Test5.40.0453.84.64.62.3
Indexing Test5.46.14.38.74.87.4
Graph (Binary Tree) Test1.11.60.580.910.821.3
Multithreading Test29.618.36.34.518.011.4
All Tests7.85.32.94.45.44.8

The results above show that in general Hibernate with PostgreSQL server is slightly more efficient than OpenJPA with Derby 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 Derby embedded database (0.045) to the normalized speed of Hibernate with PostgreSQL database server (5.4) reveals that in that case, Hibernate with PostgreSQL server is 120 times faster than OpenJPA with Derby embedded.

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 embedded database (2.2) reveals that in that case, Hibernate with PostgreSQL server is 84.6 times slower than OpenJPA with Derby embedded.

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

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 Hibernate
PostgreSQL server
OpenJPA
Derby embedded
Hibernate
PostgreSQL server
OpenJPA
Derby embedded
Hibernate
PostgreSQL server
OpenJPA
Derby embedded
Basic Person Test5.34.24.24.54.84.3
Element Collection Test0.0200.0071stopped1.60.00980.80
Inheritance Test5.10.0354.23.04.61.5
Indexing Test9.55.36.33.67.94.4
Graph (Binary Tree) Test0.0120.800.0120.930.0120.86
Multithreading Test23.35.721.86.222.56.0
All Tests7.22.76.13.36.63.0

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

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 embedded database (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 embedded.

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 embedded database (0.93) reveals that in that case, Hibernate with PostgreSQL server is 77.5 times slower than OpenJPA with Derby embedded.

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

Transaction/Retrieval SizeFew EntitiesMany EntitiesAverage Score
 Hibernate
PostgreSQL server
OpenJPA
Derby embedded
Hibernate
PostgreSQL server
OpenJPA
Derby embedded
Hibernate
PostgreSQL server
OpenJPA
Derby embedded
Basic Person Test15.715.85.69.010.712.4
Element Collection Test2.81.10.353.51.62.3
Inheritance Test15.01.36.93.710.92.5
Indexing Test5.87.27.812.06.89.6
Graph (Binary Tree) Test1.21.21.11.11.11.2
Multithreading Test30.219.813.610.921.915.3
All Tests12.18.06.06.99.17.4

The results above show that in general Hibernate with PostgreSQL server is slightly more efficient than OpenJPA with Derby embedded in performing JPA database operations.

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

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 embedded database (3.5) reveals that in that case, Hibernate with PostgreSQL server is 10.0 times slower than OpenJPA with Derby embedded.

Other Head to Head DBMS/JPA Comparisons