I started using the long application tx. pattern a while ago and am now starting to understand enough to ask a few detailed questions I can't find elsewhere. I believe the redirect functionality does not work too well with this pattern.
First take a look at two scenarios. One is the forward
1. Request comes in through filter, hibernate session starts
2. request results in JSF action method being called
3. JSF action method flags to end the conversation(long tx pattern default is to continue it)
4. JSF calls into next Form page which may load new database objects, etc. etc.
5. goes back through filter which actually ends the conversation based on the flag being set so there is no outstanding conversation which I want in this case!!!!!
That worked wonderfully, but here is what happens in a redirect even though I would want the same behavior as above......
1. Request comes in through filter, hibernate session starts
2. request results in JSF action method being called.
3. JSF action method flags to end the conversation(the default would be to continue)
4. since redirect, goes back up through filter and conversation is over
5. new request caused by redirect comes in
6. starts a new conversation
7. JSF calls the same methods in #4 for forwards to render the next page
8. conversation is left open because no action methods are called on a redirect the second time and default is to leave conversation open.
Basically, I want to make sure redirect and forward have the same functionality.....ie, the conversation should be left open on steps 3, 4, 5, 6 in the redirect case.....The flag to end the conversation should not have happened until step #8 when it should be closed so forward and redirect operate the same. Maybe, the filter should check if it is a redirect or not first and save the end conversation flag for later instead of the code I read from CaveatEmptor??????
Lastly, what is with the default behavior of continue conversation. I user to have action="someAction" in alot of my jsp code but since the default was to end the conversation, I have been going through that code and having to call action="#{bean.someAction}" just so I could make the conversation end.
thoughts?
thanks,
dean
|