Hi,

   We migrate recently to the new NHibernate 2.1, and meet a unique,
but really problematic issue.
This is working perfectly  in NHibernate 1.2 but not in 2.1.

    In NH 2.1, session.lock() is not reattaching the proxies of the
sub objects. .

    i would like to know if it's possible to force session.lock() to
reconnect the object but also the proxy of the sub objects ?

     To reproduce.

   We have a object A having a "Lazy" Many-to-one relation with B
   We have a object B having a "Lazy" Many-to-one relation with C

   Schema:   A  ->    B    ->   C.

  Scenario 1:
       I load the object A in a first NH Connection.
       My NH session is closed then i reopen It.
       I reattach the object using Session.Lock(A, lockmode.none)
       Then i access A.B.C.Name, it works fine.

      It works because the A to B proxy have been reconnect by the
lock method.

   Scenario 2:
       I load the object A in a first NH Connection.
       I access "A.B".Name
       My NH session is closed then i reopen It.
       I reattach the object using Session.Lock(A, lockmode.none)
       Then i access A.B.C.Name, it crashes, on the C accessor i get a
"No Session exception" .

        It's not working because the A object proxies have been
reconnect, but A to B proxy has been loaded during a first NH session.
So lock is not reinitialize a proxy between A and B (that's normal),
but lock should have gone to B reload its proxies.

     The only solution i found to get the second scenario ok, is to
put a cascade all on all relations, and it's not an acceptable
possibility in our project

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to