|
Thanks. I am using ThreadLocalSesion as
well. I am planning to commit and restart a transaction at the AFTER_APPLICATION
Phase – I think that should be the right place for it. My program seems
to be running OK without it – it seems that Hibernate auto flushing is
handling it correctly – at least till now. I am also wondering whether it
is absolutely necessary to implement it as well. Regards Yee From: Mufasa
[mailto:[EMAIL PROTECTED] I use a PhaseListener combined with the
ThreadLocalSession approach. If you use a PhaseListener and close after
RENDER_RESPONSE, it will properly run in the order you want.
From: Yee CN
[mailto: Hi, I have been pondering about this particular issue regarding
the usage of SessionPerRequest with JSF. In the SessionPerRequest pattern, a
hibernate session is open and a transaction started at the beginning of the
request, and the transaction is committed just before returning a response to
the browse. I have been using this pattern for a while until a couple
days ago I realized that a request in JSF usually involves an action that
navigates to another JSF. For example a viewCustomer.jsf could have a delete
customer button, which deletes the customer and navigates to listCustomer.jsf.
The sequence of action is thus: 1. Begin hibernate transaction 2 .deleteCustomerAction() 3. Deletes customer from database 4. JSF navigation to listCustomer.jsf 5. Retrieve and display customer list 6. Commit hibernate transaction There are two distinctly independent operations within the
same Httprequest. To be correct – the transaction should commit after
step 3, and a new transaction should begin. If I use ‘redirect’ in
JSF navigation that is what it would amount to. But what is the proper way to
inject the commit without redirect? Regards, Yee |

