Query and commit simultaneously

#1

Is it possible to query and commit on the same persistence manager (i.e. same odb file) at the same time?

#2

Multithreading is fully supported by ObjectDB, so you can query and update the database at the same time using multiple threads.

However, if all the threads share the same EntityManager/PersistenceManager instance then operations are executed sequentially one after the other, because almost all the operations on the database are synchronized at the EntityManager/PersistenceManager level.

To have real concurrent operations, you have to use ObjectDB 2.0 (and not ObjectDB 1.0) and you have to use multiple EntityManager/PersistenceManager instances, usually one per thread. For efficiency, all the EntityManager/PersistenceManager instances of the same database can be obtained from the same shared EntityManagerFactory/PersistenceManagerFactory instance (which can be one per application/database).

ObjectDB Support

Reply