Compare with

Comparison of Hibernate with SQLite embedded vs OpenJPA with H2 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
SQLite embedded
OpenJPA
H2 embedded
Hibernate
SQLite embedded
OpenJPA
H2 embedded
Hibernate
SQLite embedded
OpenJPA
H2 embedded
Basic Person Test0.08317.11.05.80.5511.5
Element Collection Test0.06710.90.694.90.387.9
Inheritance Test0.08014.30.995.90.5410.1
Indexing Test0.09824.41.013.70.5519.1
Graph (Binary Tree) Test0.276.80.966.70.616.7
Multithreading Testfailed34.2failed10.2failed22.2
All Tests0.1217.90.937.90.5312.9

Hibernate with SQLite embedded has failed in 2 tests (see exceptions).

The results above show that in general OpenJPA with H2 embedded is much more efficient than Hibernate with SQLite embedded in persisting JPA entity objects to the database. Comparing the normalized speed of Hibernate with SQLite embedded database (0.53) to the normalized speed of OpenJPA with H2 embedded database (12.9) reveals that in these tests, OpenJPA with H2 embedded is 24.3 times faster than Hibernate with SQLite embedded.

A huge performance gap has been detected when using database indexes with small transaction size. Comparing the normalized speed of Hibernate with SQLite embedded database (0.098) to the normalized speed of OpenJPA with H2 embedded database (24.4) reveals that in that case, OpenJPA with H2 embedded is 249 times faster than Hibernate with SQLite embedded.

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

Retrieval Size =>Few EntitiesMany EntitiesAverage Score
 Hibernate
SQLite embedded
OpenJPA
H2 embedded
Hibernate
SQLite embedded
OpenJPA
H2 embedded
Hibernate
SQLite embedded
OpenJPA
H2 embedded
Basic Person Test1.814.61.327.21.520.9
Element Collection Test0.00080.0046failed4.30.00082.1
Inheritance Test2.40.0111.47.41.93.7
Indexing Test1.917.02.335.02.126.0
Graph (Binary Tree) Test0.561.00.881.40.721.2
Multithreading Testfailed18.7failed27.6failed23.1
All Tests1.38.61.517.11.412.8

Hibernate with SQLite embedded has failed in 3 tests (see exceptions).

The results above show that in general OpenJPA with H2 embedded is much more efficient than Hibernate with SQLite embedded in retrieving JPA entity objects from the database. Comparing the normalized speed of Hibernate with SQLite embedded database (1.4) to the normalized speed of OpenJPA with H2 embedded database (12.8) reveals that in these tests, OpenJPA with H2 embedded is 9.1 times faster than Hibernate with SQLite embedded.

A huge performance gap has been detected when using simple basic entities with large retrieval size. Comparing the normalized speed of Hibernate with SQLite embedded database (1.3) to the normalized speed of OpenJPA with H2 embedded database (27.2) reveals that in that case, OpenJPA with H2 embedded is 20.9 times faster than Hibernate with SQLite embedded.

On the other hand, OpenJPA with H2 embedded is slower, for instance, when using class inheritance in the object model with small retrieval size. Comparing the normalized speed of OpenJPA with H2 embedded database (0.011) to the normalized speed of Hibernate with SQLite embedded database (2.4) reveals that in that case, OpenJPA with H2 embedded is 218 times slower than Hibernate with SQLite embedded.

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

Retrieval Size =>Few EntitiesMany EntitiesAverage Score
 Hibernate
SQLite embedded
OpenJPA
H2 embedded
Hibernate
SQLite embedded
OpenJPA
H2 embedded
Hibernate
SQLite embedded
OpenJPA
H2 embedded
Basic Person Test1.15.00.221.10.653.1
Element Collection Test0.391.7failed1.30.391.5
Inheritance Test0.532.20.281.20.401.7
Indexing Test0.001113.80.4323.20.2118.5
Multithreading Testfailed1.4failed0.60failed0.99
All Tests0.504.80.315.50.425.1

Hibernate with SQLite embedded has failed in 3 tests (see exceptions).

The results above show that in general OpenJPA with H2 embedded is much more efficient than Hibernate with SQLite embedded in executing the tested JPA queries. Comparing the normalized speed of Hibernate with SQLite embedded database (0.42) to the normalized speed of OpenJPA with H2 embedded database (5.1) reveals that in these tests, OpenJPA with H2 embedded is 12.1 times faster than Hibernate with SQLite embedded.

A huge performance gap has been detected when using database indexes with small retrieval size. Comparing the normalized speed of Hibernate with SQLite embedded database (0.0011) to the normalized speed of OpenJPA with H2 embedded database (13.8) reveals that in that case, OpenJPA with H2 embedded is 12,545 times faster than Hibernate with SQLite embedded.

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

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 Hibernate
SQLite embedded
OpenJPA
H2 embedded
Hibernate
SQLite embedded
OpenJPA
H2 embedded
Hibernate
SQLite embedded
OpenJPA
H2 embedded
Basic Person Test0.07610.00.656.00.378.0
Element Collection Test0.00220.011failed3.80.00221.9
Inheritance Test0.0790.0460.975.00.532.5
Indexing Test0.0578.90.547.00.308.0
Graph (Binary Tree) Test0.262.40.421.30.341.9
Multithreading Testfailed16.6failed4.3failed10.4
All Tests0.0946.30.654.60.345.4

Hibernate with SQLite embedded has failed in 3 tests (see exceptions).

The results above show that in general OpenJPA with H2 embedded is much more efficient than Hibernate with SQLite embedded in updating JPA entity objects in the database. Comparing the normalized speed of Hibernate with SQLite embedded database (0.34) to the normalized speed of OpenJPA with H2 embedded database (5.4) reveals that in these tests, OpenJPA with H2 embedded is 15.9 times faster than Hibernate with SQLite embedded.

A huge performance gap has been detected when using database indexes with small transaction size. Comparing the normalized speed of Hibernate with SQLite embedded database (0.057) to the normalized speed of OpenJPA with H2 embedded database (8.9) reveals that in that case, OpenJPA with H2 embedded is 156 times faster than Hibernate with SQLite embedded.

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

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 Hibernate
SQLite embedded
OpenJPA
H2 embedded
Hibernate
SQLite embedded
OpenJPA
H2 embedded
Hibernate
SQLite embedded
OpenJPA
H2 embedded
Basic Person Test0.06118.30.9111.10.4914.7
Element Collection Test0.00070.012failed2.90.00071.4
Inheritance Test0.0580.0300.906.60.483.3
Indexing Test0.07923.20.549.70.3116.4
Graph (Binary Tree) Test0.241.80.802.40.522.1
Multithreading Testfailed31.2failed17.3failed24.2
All Tests0.08812.40.798.30.4010.4

Hibernate with SQLite embedded has failed in 3 tests (see exceptions).

The results above show that in general OpenJPA with H2 embedded is much more efficient than Hibernate with SQLite embedded in deleting JPA entity objects from the database. Comparing the normalized speed of Hibernate with SQLite embedded database (0.40) to the normalized speed of OpenJPA with H2 embedded database (10.4) reveals that in these tests, OpenJPA with H2 embedded is 26.0 times faster than Hibernate with SQLite embedded.

A huge performance gap has been detected when using simple basic entities with small transaction size. Comparing the normalized speed of Hibernate with SQLite embedded database (0.061) to the normalized speed of OpenJPA with H2 embedded database (18.3) reveals that in that case, OpenJPA with H2 embedded is 300 times faster than Hibernate with SQLite embedded.

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

Transaction Size =>Few EntitiesMany EntitiesAverage Score
 Hibernate
SQLite embedded
OpenJPA
H2 embedded
Hibernate
SQLite embedded
OpenJPA
H2 embedded
Hibernate
SQLite embedded
OpenJPA
H2 embedded
Basic Person Test90.227.090.227.090.227.0
Element Collection Test82.030.682.030.682.030.6
Inheritance Test80.527.080.527.080.527.0
Indexing Test93.431.694.832.194.131.9
Graph (Binary Tree) Test67.928.550.921.459.424.9
Multithreading Testfailed33.9failed9.2failed21.5
All Tests82.829.879.724.581.227.2

Hibernate with SQLite embedded has failed in 2 tests (see exceptions).

The results above show that in general Hibernate with SQLite embedded is more efficient than OpenJPA with H2 embedded in using disk space. Comparing the normalized score of OpenJPA with H2 embedded database (27.2) to the normalized score of Hibernate with SQLite embedded database (81.2) reveals that in these tests, Hibernate with SQLite embedded is 3.0 times more efficient than OpenJPA with H2 embedded.

A large gap has been detected when using simple basic entities with small transaction size. Comparing the normalized score of OpenJPA with H2 embedded database (27.0) to the normalized score of Hibernate with SQLite embedded database (90.2) reveals that in that case, Hibernate with SQLite embedded is 3.3 times more efficient than OpenJPA with H2 embedded.

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

Transaction/Retrieval SizeFew EntitiesMany EntitiesAverage Score
 Hibernate
SQLite embedded
OpenJPA
H2 embedded
Hibernate
SQLite embedded
OpenJPA
H2 embedded
Hibernate
SQLite embedded
OpenJPA
H2 embedded
Basic Person Test0.6313.00.8110.20.7211.6
Element Collection Test0.0922.50.693.40.193.0
Inheritance Test0.633.30.915.20.774.3
Indexing Test0.4217.50.9617.70.6917.6
Graph (Binary Tree) Test0.333.00.773.00.553.0
Multithreading Testfailed20.4failed12.0failed16.2
All Tests0.4210.20.868.80.629.5

The results above show that in general OpenJPA with H2 embedded is much more efficient than Hibernate with SQLite embedded in performing JPA database operations. Comparing the normalized speed of Hibernate with SQLite embedded database (0.62) to the normalized speed of OpenJPA with H2 embedded database (9.5) reveals that in these tests, OpenJPA with H2 embedded is 15.3 times faster than Hibernate with SQLite embedded.

A huge performance gap has been detected when using database indexes with small transaction/retrieval size. Comparing the normalized speed of Hibernate with SQLite embedded database (0.42) to the normalized speed of OpenJPA with H2 embedded database (17.5) reveals that in that case, OpenJPA with H2 embedded is 41.7 times faster than Hibernate with SQLite embedded.

Other Head to Head DBMS/JPA Comparisons