Optimistic Lock Exception With No Concurrency



I have another question regarding the use of ObjectDB in my web application described in the thread https://www.objectdb.com/forum/2353:

When running tests on localhost that suppose to delete item/s in my database , I often get the OptimisticLockException and I can't figure out why, because there are not any other processes that modify objects in the database - only me.

Usually, running the same test a few more times (using http delete request) eventually works, without anything changing during this process.

What could cause this exception, knowing there couldn't be any concurrent actions on the same object?

Thanks in advanced,



Please post a full stack trace of the exception and the relevant code.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)

Note that you can still have OptimisticLockException thrown even with no multithreading if you use multiple EntityManager instances and manipulate the same object from different EntityManager instances.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)

Apparently I've misused the EntityManager: I've created just a single manager instance instead of a seperate new manager for each crud operation.

Fixing this will probably make this exception rarer.

Thanks for the clarification!

Post Reply

To post a reply and/or subscribe to update notifications - please login