Compare with

Comparison of Hibernate with Derby server vs OpenJPA 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
 Hibernate
Derby server
OpenJPA
PostgreSQL server
Hibernate
Derby server
OpenJPA
PostgreSQL server
Hibernate
Derby server
OpenJPA
PostgreSQL server
Basic Person Test3.85.23.04.83.45.0
Element Collection Test2.02.81.32.21.72.5
Inheritance Test3.44.63.03.23.23.9
Indexing Test4.87.44.16.94.47.1
Graph (Binary Tree) Test1.80.981.60.811.70.89
Multithreading Test6.923.43.99.15.416.2
All Tests3.87.42.84.53.35.9

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

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

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

Retrieval Size =>Few EntitiesMany EntitiesAverage Score
 Hibernate
Derby server
OpenJPA
PostgreSQL server
Hibernate
Derby server
OpenJPA
PostgreSQL server
Hibernate
Derby server
OpenJPA
PostgreSQL server
Basic Person Test3.85.88.416.16.110.9
Element Collection Test1.00.0131.08.71.04.4
Inheritance Test3.55.29.717.66.611.4
Indexing Test3.24.89.518.76.411.8
Graph (Binary Tree) Test0.910.271.20.351.10.31
Multithreading Test7.811.913.423.310.617.6
All Tests3.44.77.214.15.39.4

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

A large performance gap has been detected when using JPA element collections with large retrieval size. Comparing the normalized speed of Hibernate with Derby database server (1.0) to the normalized speed of OpenJPA with PostgreSQL database server (8.7) reveals that in that case, OpenJPA with PostgreSQL server is 8.7 times faster than Hibernate with Derby server.

On the other hand, OpenJPA with PostgreSQL server is slower, for instance, 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 Derby database server (1.0) reveals that in that case, OpenJPA with PostgreSQL server is 76.9 times slower than Hibernate with Derby server.

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

Retrieval Size =>Few EntitiesMany EntitiesAverage Score
 Hibernate
Derby server
OpenJPA
PostgreSQL server
Hibernate
Derby server
OpenJPA
PostgreSQL server
Hibernate
Derby server
OpenJPA
PostgreSQL server
Basic Person Test34.0failed4.1failed19.1failed
Element Collection Test33.8failed0.64failed17.2failed
Inheritance Test20.5failed5.0failed12.8failed
Indexing Test2.0failed9.2failed5.6failed
Multithreading Test36.2failed5.1failed20.6failed
All Tests25.3failed4.8failed15.1failed

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 EntitiesMany EntitiesAverage Score
 Hibernate
Derby server
OpenJPA
PostgreSQL server
Hibernate
Derby server
OpenJPA
PostgreSQL server
Hibernate
Derby server
OpenJPA
PostgreSQL server
Basic Person Test2.94.92.53.92.74.4
Element Collection Test2.30.0331.54.61.92.3
Inheritance Test2.94.83.54.93.24.9
Indexing Test3.05.14.26.03.65.6
Graph (Binary Tree) Test1.20.570.580.310.910.44
Multithreading Test6.822.22.57.44.614.8
All Tests3.26.32.54.52.85.4

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

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

On the other hand, OpenJPA with PostgreSQL server is slower, for instance, 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 Derby database server (2.3) reveals that in that case, OpenJPA with PostgreSQL server is 69.7 times slower than Hibernate with Derby server.

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

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 Hibernate
Derby server
OpenJPA
PostgreSQL server
Hibernate
Derby server
OpenJPA
PostgreSQL server
Hibernate
Derby server
OpenJPA
PostgreSQL server
Basic Person Test2.94.63.55.33.25.0
Element Collection Test1.70.0320.872.81.31.4
Inheritance Test2.94.33.64.63.24.4
Indexing Test3.78.03.67.13.77.5
Graph (Binary Tree) Test0.690.530.700.550.700.54
Multithreading Test6.217.45.19.15.613.3
All Tests3.05.82.94.93.05.4

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

A large performance gap has been detected when using JPA element collections with large transaction size. Comparing the normalized speed of Hibernate with Derby database server (0.87) to the normalized speed of OpenJPA with PostgreSQL database server (2.8) reveals that in that case, OpenJPA with PostgreSQL server is 3.2 times faster than Hibernate with Derby server.

On the other hand, OpenJPA with PostgreSQL server is slower, for instance, 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 Derby database server (1.7) reveals that in that case, OpenJPA with PostgreSQL server is 53.1 times slower than Hibernate with Derby server.

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

Transaction/Retrieval SizeFew EntitiesMany EntitiesAverage Score
 Hibernate
Derby server
OpenJPA
PostgreSQL server
Hibernate
Derby server
OpenJPA
PostgreSQL server
Hibernate
Derby server
OpenJPA
PostgreSQL server
Basic Person Test9.55.14.37.56.96.3
Element Collection Test8.20.721.14.64.62.6
Inheritance Test6.64.75.07.65.86.2
Indexing Test3.36.36.19.74.78.0
Graph (Binary Tree) Test1.20.591.00.501.10.55
Multithreading Test12.818.76.012.29.415.5
All Tests7.16.04.07.05.66.5

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

A large performance gap has been detected when using JPA element collections with large transaction/retrieval size. Comparing the normalized speed of Hibernate with Derby database server (1.1) to the normalized speed of OpenJPA with PostgreSQL database server (4.6) reveals that in that case, OpenJPA with PostgreSQL server is 4.2 times faster than Hibernate with Derby server.

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

Other Head to Head DBMS/JPA Comparisons