I have the following problem. Class A returns some objects from the database, which are runnables themselves, and runs them in the thread pool. They need to update their state as they start (they update the listeners registered on them). The problem is that they gain access to lazy fields when the object is in a detached state (because the transaction covers only the main thread) - therefore, of course, there are exceptions (com.sun.jdi.InvocationException raised by the call method). I assume that the path annotation method of each of these objects will not work, because the object is already loaded into another transaction. I'm right? How to cope with this situation?
Thanks!
source share