I know why I am getting that exception, but cant really get around it. Here is how my code looks
This gets called in a web application with OpenSessionInViewInterceptor.Code:public class FooService { public void foo(){ Bar bar= barDAO.getBar(); bar.lock(true); barDAO.updateBar(bar); //Do some stuff All in one transction //Some stuff ended bar.lock(false) barDAO.updateBar(bar); } }
bar has associated collections to it. and updateBar's Propagation behavior has to be PROPOGATION_REQUIRES_NEW, because i want to lock the bar as soon as process is started and unlock it when its ended, everything in between must be in one transaction.
I tried foo() -> PROPOGATION_REQUIRED
getBar() --> PROPOGATION REQUIRED
updateBar() --> PROPOGATION_REQUIRES_NEW
It didnt work.
The only time it worked was when i made foo() non transactional, the getBar() started a session and closed it afterwards.
Experts, please let me know your suggestions


Reply With Quote