I actually found out that the problem is raised entirely by the lazy
loading.
I do have a complex datamodell with a lot of foreign keys, composed
primary keys and so on. if access now a property over many foreign
relationships lets say
string myName = Entity1.ForeignEntity2.CompositeId.ForeignENtity3.Name

The last Property cannot be acces due to the following Exception:
NHibernate.LazyInitializationException was not treated.
  Message="Could not initialize proxy - no Session."
  Source="NHibernate"
  StackTrace:
       bei NHibernate.Proxy.AbstractLazyInitializer.Initialize() in C:
\Projekte\NHibernate\src\NHibernate\Proxy
\AbstractLazyInitializer.cs:Zeile 58.
       bei
NHibernate.Proxy.AbstractLazyInitializer.GetImplementation() in C:
\Projekte\NHibernate\src\NHibernate\Proxy
\AbstractLazyInitializer.cs:Zeile 154.
       bei
NHibernate.Proxy.Poco.Castle.CastleLazyInitializer.Intercept(IInvocation
invocation) in C:\Projekte\NHibernate\src\NHibernate\Proxy\Poco\Castle
\CastleLazyInitializer.cs:Zeile 60.
       bei Castle.DynamicProxy.AbstractInvocation.Proceed()
       bei DataTypeProxy37adfa101c1a43959c1053f74ba0ccb6.get_Name()
       bei ...

Using the debugger I can see that the entities in between are loaded
correctly. just the property of the last entity throws the exception.
For now I switched off lazy loading. But it slows down the application
tremendously, so I would be really interested on how the solve the
problem stated in the first post, while using lazy loading.
To add an additional thought to the original problem: the reason why I
want to bypass the firstlevelcache is that I want to discard all non-
persistent entities (which I added before) and retrieve only the
persistent ones (use case: the user enters data and finally hits
cancel).

If there is another way to approach that problem I would rally
appreciate your help

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