mnichols wrote:
you can reattach objects using session.Lock to reattach your previously created proxy objects to the new session
Is there a simple way to find ALL proxies, existed in session before exception?
Now we use a single permanent session in out app (WinForms) and we may have a bunch of proxies. We use static Repository class and underlying PersistentManager class (a kind of SessionFactory+Session wrapper) to encapsulate all NHibernate stuff, so it seems to be reasonable to add session recreation and proxies rebinding code to this layer - after each transaction rollback in catch blocks.
BTW maybe there is some opportunity to get rid of permanent session without loosing lazy load capabilities? Maybe a sort of proxy access interception or LazyInitializationException handling - to reattach proxy to session, perform it's initialization and then disconnect?
Please forgive if it is are a stupid question, I'm just a newbie to all this stuff...