Optimistic Lock Exception With No Concurrency

#1

Hello,

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,

Yotam

#2

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

ObjectDB Support
#3

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
#4

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!

Reply