Maybe some more details will help.
At a high level, this what i'm trying to accomplish:
Code:
// save user selections
profileDelegate.setUserInterestsAnswers(userId, answers);
// forward to view interests page
return new ActionForward("interests", "/profile/interests/index.jsp?membername=" + request.getParameter("membername"), true, true);
1. Save answers
2. Forward to a new page to view answers
What looks like is happening is that the setUserInterestsAnswers() method, which ultimately ends up calling the session.delete() and session.save() methods from the first post, returns control of execution before the database has finished inserting the data. The reason i know this is that when i look at my server log, there are insert SQL statements from the session.save() method call interspersed with SQL statements that retrieve data for the page that is getting forwarded to.
Now, if you follow the code, you'll see that the session.delete() and session.save() calls are made prior to forwarding to the new page, but in execution, it looks like they are happening in parallel.
Does hibernate spawn threads for inserts that run in parallel with the main execution thread???