Hi,
A little design quesion, after reading
http://www.hibernate.org/168.html [Session and Transaction scope] I am a bit confused how to destinquish the session-per-application-transaction and the anti-pattern session-per-application.
Let's give a simple example (implemented with servlets/jsp):
User logs in to website.
User opens his shoppingcart.
User adds a product.
User goes to checkout.
User leaves the browser and servlet waits till timeout.
What is good by design? I would suggest:
1. Retrieve a Hibernate Session and place it in a Threadlocal.
2. Retrieve the cart of the user from the session and place it in the servlet session object.
2. Retrieve a product from the session and add it to the cart.
3. Update the cart with the session.
4. On timeout of the httpsession close the hibernate session.
This looks like the session-per-application anti-pattern. Can somebody please give me a description on how this should be solved.