Try to work with session-per-request when the application has business-transactions involving more than one request in many use-case is not so easy.If you can translate from spanish... http://fabiomaulo.blogspot.com/2009/04/empezando-con-nh-session.html
2009/5/30 Guga Oliveira <[email protected]> > > Hello all, > > I have some question about my little experience with nhibernate. We > are working with hibernate in some projects here, and we are using the > session-per-request pattern. > > But we have read some posts and became in doubt with some approach. > > In my first request to a page I load a object, populate controls, save > the object to the asp.net session and return the page to the user. My > question is in the second request, let think if a user clicks on a > button to save changes. Currently here we get the object from the > asp.net session, update the properties and then make the object > persistent and flush the session. > > What is the best approach? To load the object from the session or to > re-load object from the database by an id? Is that a problem to save > the working objects in the asp.net session? > > Another question is if I have some master detail, we load the master > objects, populate the controls, populate a grid with the detail list > (are mapped with inverse and cascade), and them save the master to the > asp.net session. In the second request we reload the master object > from the session and do the job of add or delete details, and update > the master. In this approach how is the best way to work, saving in > asp.net session or reloading in every request. > > That comes to another question, when working with ajax. Let think that > we have a panel to add detail data to the detail list in grid. When > the user clicks to "add" button a request is made to page, so what is > the correct to do? load master from the aspnet session, add the new > detail object to the detail list related to master, and re-save the > object to the session, or, reload master object from nhibernate, add > the detail to detail list, and flush the session? if the second > approach is the correct, if the users wants to cancel the updates we > have to delete the detail objects added to the list, and so we have to > maintain the ids added in the current process. > > Someone with great expertise can help us? > > Thanks a lot > > > > > > > -- Fabio Maulo --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nhusers?hl=en -~----------~----~----~----~------~----~------~--~---
