Just the basics: I'm using DataNucleus backed with an embedded DB4O database.
If I do this simple test:
PersistenceManager pm1 = persistenceManagerFactory.getPersistenceManager();
PersistenceManager pm2 = persistenceManagerFactory.getPersistenceManager();
pm1.makePersistent(t1);
pm2.makePersistent(t2);
I get a file locked exception:
com.db4o.ext.DatabaseFileLockedException: C:\<path>\primary_datastore.data
Which tells me I don't know how the PersistenceManager
is supposed to work. I thought I just called PersistenceManagerFactory
whenever I needed a PersistenceManager
to query or persist data and I would get something thread safe.
- Do I need to make PersistenceManager a singleton across my entire application?
- How do multiple threads, performing queries and updates work in JDO/DataNucleus?