Appengine JDO - "managed by a different Object Manager"

359 views Asked by At

I am doing multiple job in multithreading, and I get this error when I try to fetch an entity from the datastore:

Object with id "com.google.appengine.api.datastore.Key:XXXXXXX(xxx)" is managed by a different Object Manager

The happen during a unit test. The problem is that I am tracking the creation of the persistence managers during the test, and I am sure that I just create only one using

JDOHelper.getPersistenceManagerFactory("transactions-optional").getPersistenceManager()

If I execute the same job using only the main thread nothing happens, everything work as expected.

I read that in order to debug this, you may call JDOHelper.getPersistenceManager(object) in order to know which persistence manager manages that object. I never get different address. Besides, calling this method before during the fetch sometime make the call succeed without any error.

0

There are 0 answers