Compare with

Comparison of OpenJPA with H2 embedded vs Hibernate with SQLite 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
 OpenJPA
H2 embedded
Hibernate
SQLite embedded
OpenJPA
H2 embedded
Hibernate
SQLite embedded
OpenJPA
H2 embedded
Hibernate
SQLite embedded
Basic Person Test17.10.0835.81.011.50.55
Element Collection Test10.90.0674.90.697.90.38
Inheritance Test14.30.0805.90.9910.10.54
Indexing Test24.40.09813.71.019.10.55
Graph (Binary Tree) Test6.80.276.70.966.70.61
Multithreading Test34.2failed10.2failed22.2failed
All Tests17.90.127.90.9312.90.53

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
 OpenJPA
H2 embedded
Hibernate
SQLite embedded
OpenJPA
H2 embedded
Hibernate
SQLite embedded
OpenJPA
H2 embedded
Hibernate
SQLite embedded
Basic Person Test14.61.827.21.320.91.5
Element Collection Test0.00460.00084.3failed2.10.0008
Inheritance Test0.0112.47.41.43.71.9
Indexing Test17.01.935.02.326.02.1
Graph (Binary Tree) Test1.00.561.40.881.20.72
Multithreading Test18.7failed27.6failed23.1failed
All Tests8.61.317.11.512.81.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 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
 OpenJPA
H2 embedded
Hibernate
SQLite embedded
OpenJPA
H2 embedded
Hibernate
SQLite embedded
OpenJPA
H2 embedded
Hibernate
SQLite embedded
Basic Person Test5.01.11.10.223.10.65
Element Collection Test1.70.391.3failed1.50.39
Inheritance Test2.20.531.20.281.70.40
Indexing Test13.80.001123.20.4318.50.21
Multithreading Test1.4failed0.60failed0.99failed
All Tests4.80.505.50.315.10.42

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
 OpenJPA
H2 embedded
Hibernate
SQLite embedded
OpenJPA
H2 embedded
Hibernate
SQLite embedded
OpenJPA
H2 embedded
Hibernate
SQLite embedded
Basic Person Test10.00.0766.00.658.00.37
Element Collection Test0.0110.00223.8failed1.90.0022
Inheritance Test0.0460.0795.00.972.50.53
Indexing Test8.90.0577.00.548.00.30
Graph (Binary Tree) Test2.40.261.30.421.90.34
Multithreading Test16.6failed4.3failed10.4failed
All Tests6.30.0944.60.655.40.34

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
 OpenJPA
H2 embedded
Hibernate
SQLite embedded
OpenJPA
H2 embedded
Hibernate
SQLite embedded
OpenJPA
H2 embedded
Hibernate
SQLite embedded
Basic Person Test18.30.06111.10.9114.70.49
Element Collection Test0.0120.00072.9failed1.40.0007
Inheritance Test0.0300.0586.60.903.30.48
Indexing Test23.20.0799.70.5416.40.31
Graph (Binary Tree) Test1.80.242.40.802.10.52
Multithreading Test31.2failed17.3failed24.2failed
All Tests12.40.0888.30.7910.40.40

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
 OpenJPA
H2 embedded
Hibernate
SQLite embedded
OpenJPA
H2 embedded
Hibernate
SQLite embedded
OpenJPA
H2 embedded
Hibernate
SQLite embedded
Basic Person Test27.090.227.090.227.090.2
Element Collection Test30.682.030.682.030.682.0
Inheritance Test27.080.527.080.527.080.5
Indexing Test31.693.432.194.831.994.1
Graph (Binary Tree) Test28.567.921.450.924.959.4
Multithreading Test33.9failed9.2failed21.5failed
All Tests29.882.824.579.727.281.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
 OpenJPA
H2 embedded
Hibernate
SQLite embedded
OpenJPA
H2 embedded
Hibernate
SQLite embedded
OpenJPA
H2 embedded
Hibernate
SQLite embedded
Basic Person Test13.00.6310.20.8111.60.72
Element Collection Test2.50.0923.40.693.00.19
Inheritance Test3.30.635.20.914.30.77
Indexing Test17.50.4217.70.9617.60.69
Graph (Binary Tree) Test3.00.333.00.773.00.55
Multithreading Test20.4failed12.0failed16.2failed
All Tests10.20.428.80.869.50.62

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