Good day! I wrote some JUnit tests that create separate objectdb databases and exercise the entities therein (via read/write operations). The tests run fine individually, but when I run "all tests," one fails consistently with the message: com.objectdb.o._JdoUserException: Object 'actr.model.Symbol#7' belongs to another EntityManager [Symbol:7]
When I change the order in which the test runs (by changing the name of the test class), the Exception goes away. Suspecting a multi-threading issue, I tried using ThreadLocal on the PersistenceManager created from a once-per-test-class call to the PersistenceManagerFactory, locking down set/get methods of the Symbol class via java.util.concurrent.locks.ReentrantReadWriteLock locks, and varying the length (number of actions) within a transaction, to no avail.
I'm using JDO, and I only ever knowingly create one PersistenceManager, which suggests (to me) that I'm not controlling the Symbol class adequately. (@PersistenceCapable annotates the Symbol class, which has a private non-static member named string but a few static members too).
I'm curious for insights into where you think the problem might lurk and how I might overcome it. I'm not suggesting this is a bug with objectdb, only with my use of it. I will be happy to share a stack trace and some code snippets if they would aid understanding. I'm merely trying to determine where to look and what to try next. Thank you!