I have a question with multiple sessions. In our B2B application, we are following 'Session per Request Thread' approach. This is being acheived by ThreadLocal. However, in certain situations we have to spawn a new Thread because we do not want the user to share this burden in his/her wait times.
So coming to the question, If I modify an object inside the new thread such that the object might have been loaded in the request thread, hibernate bombs. This is a classic type of problem when designing database access.
We initially thought we could detach the object from the request session, but in some cases we do need the object until the whole request thread is executed.
We thought of recreating the object from the business code but it seems like we still would have the same problem.
I was wondering how users of hibernate have tackled this situation.
Any suggestions/pointers/design patterns would really be helpful.