Compare with

Comparison of OpenJPA with Derby server vs Hibernate with PostgreSQL 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
 OpenJPA
Derby server
Hibernate
PostgreSQL server
OpenJPA
Derby server
Hibernate
PostgreSQL server
OpenJPA
Derby server
Hibernate
PostgreSQL server
Basic Person Test3.17.12.73.42.95.2
Element Collection Test2.02.91.71.71.82.3
Inheritance Test3.07.02.33.62.65.3
Indexing Test4.79.34.16.14.47.7
Graph (Binary Tree) Test0.713.00.642.90.672.9
Multithreading Test6.031.73.813.94.922.8
All Tests3.310.22.55.32.97.7

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
 OpenJPA
Derby server
Hibernate
PostgreSQL server
OpenJPA
Derby server
Hibernate
PostgreSQL server
OpenJPA
Derby server
Hibernate
PostgreSQL server
Basic Person Test0.785.511.611.56.28.5
Element Collection Test0.00240.0251.10.0170.540.021
Inheritance Test0.0145.25.014.02.59.6
Indexing Test0.624.613.013.36.88.9
Graph (Binary Tree) Test0.0650.610.390.780.230.70
Multithreading Test1.611.319.017.010.314.2
All Tests0.514.58.49.44.47.0

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
 OpenJPA
Derby server
Hibernate
PostgreSQL server
OpenJPA
Derby server
Hibernate
PostgreSQL server
OpenJPA
Derby server
Hibernate
PostgreSQL server
Basic Person Test29.255.55.56.117.330.8
Element Collection Test2.211.01.40.0161.85.5
Inheritance Test2.252.31.08.71.630.5
Indexing Test2.20.05011.78.87.04.4
Multithreading Test35.555.28.39.221.932.2
All Tests14.334.85.66.69.920.7

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
 OpenJPA
Derby server
Hibernate
PostgreSQL server
OpenJPA
Derby server
Hibernate
PostgreSQL server
OpenJPA
Derby server
Hibernate
PostgreSQL server
Basic Person Test1.55.34.02.72.84.0
Element Collection Test0.00810.0671.90.0260.940.046
Inheritance Test0.0435.43.83.81.94.6
Indexing Test1.85.46.84.34.34.8
Graph (Binary Tree) Test0.161.10.270.580.220.82
Multithreading Test6.929.65.06.35.918.0
All Tests1.77.83.62.92.75.4

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
 OpenJPA
Derby server
Hibernate
PostgreSQL server
OpenJPA
Derby server
Hibernate
PostgreSQL server
OpenJPA
Derby server
Hibernate
PostgreSQL server
Basic Person Test1.45.33.74.22.54.8
Element Collection Test0.00820.0201.4stopped0.710.0098
Inheritance Test0.0355.12.54.21.34.6
Indexing Test2.39.53.56.32.97.9
Graph (Binary Tree) Test0.130.0120.350.0120.240.012
Multithreading Test3.623.34.021.83.822.5
All Tests1.37.22.66.11.96.6

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
 OpenJPA
Derby server
Hibernate
PostgreSQL server
OpenJPA
Derby server
Hibernate
PostgreSQL server
OpenJPA
Derby server
Hibernate
PostgreSQL server
Basic Person Test7.215.75.55.66.410.7
Element Collection Test0.842.81.50.351.21.6
Inheritance Test1.115.02.96.92.010.9
Indexing Test2.35.87.87.85.16.8
Graph (Binary Tree) Test0.271.20.411.10.341.1
Multithreading Test10.730.28.013.69.421.9
All Tests3.912.14.56.04.29.1

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