Hello,
I still don't really understand how to manage the session. That's why I hope somebody will make it clear using a example I thought off, here goes:
User opens a persisted order which is passed to the UI layer (open a session, retrieve order, close session and pass it to UI layer).
Order contains a object address which needs to be replaced by another address. User clicks in UI on change address and a addresspanel pops up. Address panel reads all addresses from database, but because it are more than 2000 adresses they are paged per 100. (Business logic opens new session to retrieve addresses, passes a page with objects to UI layer and leaves session open for another page (?) Session is closed when new selected adres is returned). User decides to create three orders,order1 and order3 have same adress, but are from different sessions.
User saves the order entries. (new Session is created and instances are saveupdated()).
Can somebody please tell me if this is the correct method of handling with sessions. Now is use a single session for all this, but that is an anti-pattern. The two biggest problems I have are:
* pageing the result leaves session open and could result in timeout on sql connection
* saving the three orders with two addresses with the same identifier and which are different objects (two sessions) results in an exception.
Thank you very much for helping.
_________________ Dencel
- The sun has never seen a shadow -
|