FindDirty won't function without a SessionScope: No shared 1st level cache, no dirty checking...
-Markus 2009/8/6 Gerdus van Zyl <[email protected]> > > I have pretty much given up on using a sessionscope or long lived > session at all. Currently I just let activerecord create a new scope > every time it's needed. > > Now I just need to fix the dynamicupdate issue. I think FindDirty is > what I need but I can't seem to get it working. > AR wraps the currentState using DictionaryAdapter where I am > struggling to get the integer index out again. > > thank you for all the help :-) > > ~G > > On Thu, Aug 6, 2009 at 4:16 PM, Markus Zywitza<[email protected]> > wrote: > > Ok, back to the beginning: > > > >> > >> The solution that came close to working is to have a > >> sessionscope(flushaction.never) on application load and then save > >> within a transactionscope. This did not work since I am getting > >> "object can't be associated with more than one session" errors. I also > >> tried SaveCopy which worked with single object but not if it had a > >> hasmany relationship. > > > > > > The exception comes from nesting TransactionScopes. If you have only one > > TransactionScope, it uses the outer SessionScope and gives access to its > > transaction. But if you nest TransactionScopes requiring new transactions > > (instead of just accessing an outer transaction), the TransactionScope > has > > to create a new SessionScope, because NH allows only one active > transaction > > per session. > > > > Can you verify this in a simplified subset of your application? > > > > Ah, by the way: Fabio Maulo (NH-Maintainer) calls the > > Session-Per-Application-Pattern a "recipe for desaster"... So you better > try > > session-per-form or session-per-thread if you have multiple worker > threads. > > > > -Markus > > > > 2009/8/6 Gerdus van Zyl <[email protected]> > >> > >> I am looking for fine grained last update wins concurrency. If you > >> have two people update the same object but not the same field it > >> should work and if they update the same field the last change should > >> win. > >> > >> On Thu, Aug 6, 2009 at 1:06 PM, Markus Zywitza<[email protected] > > > >> wrote: > >> > Is there an actual problem with not doing dynamic updates? If not, > then > >> > remember Knuth's rules for optimizations: > >> > 1) Don't do it. > >> > 2) Don't do it yet. > >> > The NHiA-Book uses detached objects with multiple sessions for their > >> > examples. This translates directly into AR w/o SessionScope which uses > a > >> > separate session and transaction per operation. > >> > -Markus > >> > > >> > 2009/8/6 Gerdus van Zyl <[email protected]> > >> >> > >> >> Hi, > >> >> > >> >> What is the recommended way of using sessionscope in a window form > >> >> project? (many forms open at once) > >> >> > >> >> The solution that came close to working is to have a > >> >> sessionscope(flushaction.never) on application load and then save > >> >> within a transactionscope. This did not work since I am getting > >> >> "object can't be associated with more than one session" errors. I > also > >> >> tried SaveCopy which worked with single object but not if it had a > >> >> hasmany relationship. > >> >> > >> >> Alternatively the app works fine without a sessionscope and I can > live > >> >> without the batching and first level cache but would like to get > >> >> dynamicupdate working. I have information on which properties have > >> >> changed so how can I share that info with nhibernate so it only > >> >> generates updates with the changed columns? > >> >> > >> >> thank you. > >> >> Gerdus > >> >> >> > >> > > >> >> > > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Castle Project Users" 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/castle-project-users?hl=en -~----------~----~----~----~------~----~------~--~---
