myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "::SammyRulez::" <sammyru...@gmail.com>
Subject Re: Question: Hibernate SessionPerRequest with JSF navigation
Date Wed, 07 Dec 2005 07:35:28 GMT
I use this aproch in my apps to. session.flush is enught

2005/12/7, Yee CN <yeecn@streamyx.com>:
>
>
>
> 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
>
>
>
>
>
>
>
>


--
::SammyRulez::
http://sammyprojectz.blogspot.com
Mime
View raw message