Compare with

Comparison of Hibernate with Derby embedded vs OpenJPA with HSQLDB 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
Derby embedded
OpenJPA
HSQLDB embedded
Hibernate
Derby embedded
OpenJPA
HSQLDB embedded
Hibernate
Derby embedded
OpenJPA
HSQLDB embedded
Basic Person Test5.913.33.86.94.910.1
Element Collection Test2.98.61.85.32.37.0
Inheritance Test5.312.23.75.84.59.0
Indexing Test7.016.74.89.15.912.9
Graph (Binary Tree) Test1.96.11.77.31.86.7
Multithreading Test10.526.83.77.07.116.9
All Tests5.613.93.36.94.410.4

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

A large performance gap has been detected when using graphs of objects with large transaction size. Comparing the normalized speed of Hibernate with Derby embedded database (1.7) to the normalized speed of OpenJPA with HSQLDB embedded database (7.3) reveals that in that case, OpenJPA with HSQLDB embedded is 4.3 times faster than Hibernate with Derby embedded.

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

Retrieval Size =>Few EntitiesMany EntitiesAverage Score
 Hibernate
Derby embedded
OpenJPA
HSQLDB embedded
Hibernate
Derby embedded
OpenJPA
HSQLDB embedded
Hibernate
Derby embedded
OpenJPA
HSQLDB embedded
Basic Person Test14.221.816.430.115.325.9
Element Collection Test4.40.00684.94.54.62.2
Inheritance Test10.30.002518.62.014.40.98
Indexing Test10.022.116.443.613.232.9
Graph (Binary Tree) Test2.62.13.02.12.82.1
Multithreading Test19.320.919.323.519.322.2
All Tests10.111.113.117.611.614.4

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

A large performance gap has been detected when using database indexes with large retrieval size. Comparing the normalized speed of Hibernate with Derby embedded database (16.4) to the normalized speed of OpenJPA with HSQLDB embedded database (43.6) reveals that in that case, OpenJPA with HSQLDB embedded is 2.7 times faster than Hibernate with Derby embedded.

On the other hand, OpenJPA with HSQLDB embedded is slower, for instance, when using class inheritance in the object model with small retrieval size. Comparing the normalized speed of OpenJPA with HSQLDB embedded database (0.0025) to the normalized speed of Hibernate with Derby embedded database (10.3) reveals that in that case, OpenJPA with HSQLDB embedded is 4,120 times slower than Hibernate with Derby embedded.

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

Retrieval Size =>Few EntitiesMany EntitiesAverage Score
 Hibernate
Derby embedded
OpenJPA
HSQLDB embedded
Hibernate
Derby embedded
OpenJPA
HSQLDB embedded
Hibernate
Derby embedded
OpenJPA
HSQLDB embedded
Basic Person Test49.32.86.80.9128.11.9
Element Collection Test37.61.42.70.9520.11.2
Inheritance Test24.12.47.61.315.91.8
Indexing Test5.315.414.834.310.124.9
Multithreading Test39.71.46.10.5322.90.95
All Tests31.24.77.67.619.46.1

The results above show that in general Hibernate with Derby embedded is much more efficient than OpenJPA with HSQLDB embedded in executing the tested JPA queries. Comparing the normalized speed of OpenJPA with HSQLDB embedded database (6.1) to the normalized speed of Hibernate with Derby embedded database (19.4) reveals that in these tests, Hibernate with Derby embedded is 3.2 times faster than OpenJPA with HSQLDB embedded.

A huge performance gap has been detected when using multithreading with small retrieval size. Comparing the normalized speed of OpenJPA with HSQLDB embedded database (1.4) to the normalized speed of Hibernate with Derby embedded database (39.7) reveals that in that case, Hibernate with Derby embedded is 28.4 times faster than OpenJPA with HSQLDB embedded.

On the other hand, Hibernate with Derby embedded is slower, for instance, when using database indexes with small retrieval size. Comparing the normalized speed of Hibernate with Derby embedded database (5.3) to the normalized speed of OpenJPA with HSQLDB embedded database (15.4) reveals that in that case, Hibernate with Derby embedded is 2.9 times slower than OpenJPA with HSQLDB embedded.

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

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 Hibernate
Derby embedded
OpenJPA
HSQLDB embedded
Hibernate
Derby embedded
OpenJPA
HSQLDB embedded
Hibernate
Derby embedded
OpenJPA
HSQLDB embedded
Basic Person Test4.512.03.25.33.88.6
Element Collection Test3.90.0173.13.73.51.8
Inheritance Test4.60.00984.52.04.50.99
Indexing Test4.69.35.55.55.17.4
Graph (Binary Tree) Test2.72.51.21.62.02.1
Multithreading Test11.620.02.63.77.111.8
All Tests5.37.33.33.64.35.5

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

A large performance gap has been detected when using simple basic entities with small transaction size. Comparing the normalized speed of Hibernate with Derby embedded database (4.5) to the normalized speed of OpenJPA with HSQLDB embedded database (12.0) reveals that in that case, OpenJPA with HSQLDB embedded is 2.7 times faster than Hibernate with Derby embedded.

On the other hand, OpenJPA with HSQLDB embedded is slower, for instance, when using class inheritance in the object model with small transaction size. Comparing the normalized speed of OpenJPA with HSQLDB embedded database (0.0098) to the normalized speed of Hibernate with Derby embedded database (4.6) reveals that in that case, OpenJPA with HSQLDB embedded is 469 times slower than Hibernate with Derby embedded.

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

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 Hibernate
Derby embedded
OpenJPA
HSQLDB embedded
Hibernate
Derby embedded
OpenJPA
HSQLDB embedded
Hibernate
Derby embedded
OpenJPA
HSQLDB embedded
Basic Person Test3.821.34.215.74.018.5
Element Collection Test2.30.0111.52.91.91.5
Inheritance Test4.00.00704.33.54.21.8
Indexing Test5.528.83.615.24.622.0
Graph (Binary Tree) Test0.742.90.963.60.853.2
Multithreading Test5.626.04.919.65.322.8
All Tests3.713.23.310.13.511.6

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

A large performance gap has been detected when using simple basic entities with small transaction size. Comparing the normalized speed of Hibernate with Derby embedded database (3.8) to the normalized speed of OpenJPA with HSQLDB embedded database (21.3) reveals that in that case, OpenJPA with HSQLDB embedded is 5.6 times faster than Hibernate with Derby embedded.

On the other hand, OpenJPA with HSQLDB embedded is slower, for instance, when using class inheritance in the object model with small transaction size. Comparing the normalized speed of OpenJPA with HSQLDB embedded database (0.0070) to the normalized speed of Hibernate with Derby embedded database (4.0) reveals that in that case, OpenJPA with HSQLDB embedded is 571 times slower than Hibernate with Derby embedded.

Comparison of database storage efficiency (normalized score, higher is better)

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 Hibernate
Derby embedded
OpenJPA
HSQLDB embedded
Hibernate
Derby embedded
OpenJPA
HSQLDB embedded
Hibernate
Derby embedded
OpenJPA
HSQLDB embedded
Basic Person Test52.741.452.741.452.741.4
Element Collection Test42.346.942.346.942.346.9
Inheritance Test49.241.449.241.449.241.4
Indexing Test53.048.453.949.253.448.8
Graph (Binary Tree) Test13.128.59.821.411.525.0
Multithreading Test49.351.98.810.329.031.1
All Tests43.343.136.135.139.739.1

The results above show that in general Hibernate with Derby embedded is slightly more efficient than OpenJPA with HSQLDB embedded in using disk space.

On the other hand, Hibernate with Derby embedded is slower, for instance, when using graphs of objects with large transaction size. Comparing the normalized score of Hibernate with Derby embedded database (9.8) to the normalized score of OpenJPA with HSQLDB embedded database (21.4) reveals that in that case, Hibernate with Derby embedded is 2.2 times less efficient than OpenJPA with HSQLDB embedded.

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

Transaction/Retrieval SizeFew EntitiesMany EntitiesAverage Score
 Hibernate
Derby embedded
OpenJPA
HSQLDB embedded
Hibernate
Derby embedded
OpenJPA
HSQLDB embedded
Hibernate
Derby embedded
OpenJPA
HSQLDB embedded
Basic Person Test15.514.36.911.811.213.0
Element Collection Test10.22.02.83.56.52.7
Inheritance Test9.72.97.72.98.72.9
Indexing Test6.518.59.021.67.820.0
Graph (Binary Tree) Test2.03.41.73.71.83.5
Multithreading Test17.319.07.310.912.314.9
All Tests10.510.26.19.28.39.7

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

A large performance gap has been detected when using database indexes with small transaction/retrieval size. Comparing the normalized speed of Hibernate with Derby embedded database (6.5) to the normalized speed of OpenJPA with HSQLDB embedded database (18.5) reveals that in that case, OpenJPA with HSQLDB embedded is 2.8 times faster than Hibernate with Derby embedded.

On the other hand, OpenJPA with HSQLDB embedded is slower, for instance, when using JPA element collections with small transaction/retrieval size. Comparing the normalized speed of OpenJPA with HSQLDB embedded database (2.0) to the normalized speed of Hibernate with Derby embedded database (10.2) reveals that in that case, OpenJPA with HSQLDB embedded is 5.1 times slower than Hibernate with Derby embedded.

Other Head to Head DBMS/JPA Comparisons