Compare with

Comparison of Hibernate with SQLite embedded vs OpenJPA with H2 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
SQLite embedded
OpenJPA
H2 server
Hibernate
SQLite embedded
OpenJPA
H2 server
Hibernate
SQLite embedded
OpenJPA
H2 server
Basic Person Test0.0833.71.02.20.552.9
Element Collection Test0.0672.60.691.50.382.1
Inheritance Test0.0804.50.992.00.543.2
Indexing Test0.0987.31.03.60.555.4
Graph (Binary Tree) Test0.271.10.960.840.610.97
Multithreading Testfailed7.7failed4.2failed5.9
All Tests0.124.50.932.40.533.4

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

The results above show that in general OpenJPA with H2 server 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 database server (3.4) reveals that in these tests, OpenJPA with H2 server is 6.4 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 database server (7.3) reveals that in that case, OpenJPA with H2 server is 74.5 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 server
Hibernate
SQLite embedded
OpenJPA
H2 server
Hibernate
SQLite embedded
OpenJPA
H2 server
Basic Person Test1.82.91.37.61.55.2
Element Collection Test0.00080.0022failed1.90.00080.93
Inheritance Test2.40.0131.44.01.92.0
Indexing Test1.94.12.38.82.16.5
Graph (Binary Tree) Test0.560.380.880.490.720.44
Multithreading Testfailed5.9failed14.0failed10.0
All Tests1.32.21.56.11.44.2

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

The results above show that in general OpenJPA with H2 server 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 database server (4.2) reveals that in these tests, OpenJPA with H2 server is 3.0 times faster than Hibernate with SQLite embedded.

A large 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 database server (7.6) reveals that in that case, OpenJPA with H2 server is 5.8 times faster than Hibernate with SQLite embedded.

On the other hand, OpenJPA with H2 server is slower, for instance, when using class inheritance in the object model with small retrieval size. Comparing the normalized speed of OpenJPA with H2 database server (0.013) to the normalized speed of Hibernate with SQLite embedded database (2.4) reveals that in that case, OpenJPA with H2 server is 185 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 server
Hibernate
SQLite embedded
OpenJPA
H2 server
Hibernate
SQLite embedded
OpenJPA
H2 server
Basic Person Test1.13.70.221.00.652.4
Element Collection Test0.392.0failed1.20.391.6
Inheritance Test0.532.80.281.10.402.0
Indexing Test0.00113.80.437.50.215.7
Multithreading Testfailed0.98failed1.0failed1.0
All Tests0.502.70.312.40.422.5

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

The results above show that in general OpenJPA with H2 server 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 database server (2.5) reveals that in these tests, OpenJPA with H2 server is 6.0 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 database server (3.8) reveals that in that case, OpenJPA with H2 server is 3,455 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 server
Hibernate
SQLite embedded
OpenJPA
H2 server
Hibernate
SQLite embedded
OpenJPA
H2 server
Basic Person Test0.0763.00.652.00.372.5
Element Collection Test0.00220.0078failed1.90.00220.94
Inheritance Test0.0790.0340.972.80.531.4
Indexing Test0.0572.80.543.20.303.0
Graph (Binary Tree) Test0.260.790.420.430.340.61
Multithreading Testfailed7.0failed2.5failed4.8
All Tests0.0942.30.652.10.342.2

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

The results above show that in general OpenJPA with H2 server 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 database server (2.2) reveals that in these tests, OpenJPA with H2 server is 6.5 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 database server (2.8) reveals that in that case, OpenJPA with H2 server is 49.1 times faster than Hibernate with SQLite embedded.

On the other hand, OpenJPA with H2 server is slower, for instance, when using class inheritance in the object model with small transaction size. Comparing the normalized speed of OpenJPA with H2 database server (0.034) to the normalized speed of Hibernate with SQLite embedded database (0.079) reveals that in that case, OpenJPA with H2 server is 2.3 times slower 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 server
Hibernate
SQLite embedded
OpenJPA
H2 server
Hibernate
SQLite embedded
OpenJPA
H2 server
Basic Person Test0.0613.20.912.20.492.7
Element Collection Test0.00070.0060failed0.880.00070.44
Inheritance Test0.0580.0300.903.10.481.6
Indexing Test0.0796.50.543.60.315.1
Graph (Binary Tree) Test0.240.730.800.750.520.74
Multithreading Testfailed7.6failed5.2failed6.4
All Tests0.0883.00.792.60.402.8

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

The results above show that in general OpenJPA with H2 server 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 database server (2.8) reveals that in these tests, OpenJPA with H2 server is 7.0 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.079) to the normalized speed of OpenJPA with H2 database server (6.5) reveals that in that case, OpenJPA with H2 server is 82.3 times faster than Hibernate with SQLite embedded.

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

Transaction/Retrieval SizeFew EntitiesMany EntitiesAverage Score
 Hibernate
SQLite embedded
OpenJPA
H2 server
Hibernate
SQLite embedded
OpenJPA
H2 server
Hibernate
SQLite embedded
OpenJPA
H2 server
Basic Person Test0.633.30.813.00.723.1
Element Collection Test0.0920.930.691.50.191.2
Inheritance Test0.631.50.912.60.772.0
Indexing Test0.424.90.965.40.695.1
Graph (Binary Tree) Test0.330.750.770.630.550.69
Multithreading Testfailed5.9failed5.4failed5.6
All Tests0.422.90.863.20.623.0

The results above show that in general OpenJPA with H2 server 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 database server (3.0) reveals that in these tests, OpenJPA with H2 server is 4.8 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 database server (4.9) reveals that in that case, OpenJPA with H2 server is 11.7 times faster than Hibernate with SQLite embedded.

Other Head to Head DBMS/JPA Comparisons