Hi...
I've encountered a serious problem recently - a few days ago - and I have absolutely no idea how to help myself..
It all started out with a mapping:
Code:
<class name="Folder" proxy="false">
<id name="ID">
<generator class="sequence">
<param name="sequence">folder_id_sequence</param>
</generator>
</id>
<property name="Name" />
<property name="Type" />
<many-to-one name="Owner" />
<list name="Messages">
<key column="folder_id" />
<index />
<one-to-many class="PrivateMessage" />
</list>
</class>
This mapping compiles fine and serves me well - as long as I dont try to load anything from the Database. Each and every attempt to do such a thing gets interrupted by the ever-same exception: "Creating a proxy instance failed".
I've already tried to fix that by myself (playing with the mapping, visibility levels in the persisted class, etc), but nothing worked :(
Every property of the class is marked virtual and either a string, enum or another persisted class. And - as if it weren't weird enough that it doesn't work - it works after taking out the mapping for Owner. Marking it nonlazy works as well - but that's not what I intended.
Stacktrace:
Code:
at NHibernate.Proxy.CastleProxyFactory.GetProxy(Object id, ISessionImplementor session) in F:\NHibernate-1.2.0.Beta2-debug\src\NHibernate\Proxy\CastleProxyFactory.cs:line 71
at NHibernate.Persister.Entity.AbstractEntityPersister.CreateProxy(Object id, ISessionImplementor session) in F:\NHibernate-1.2.0.Beta2-debug\src\NHibernate\Persister\Entity\AbstractEntityPersister.cs:line 1603
at NHibernate.Impl.SessionImpl.DoLoadByClass(Type clazz, Object id, Boolean checkDeleted, Boolean allowProxyCreation) in F:\NHibernate-1.2.0.Beta2-debug\src\NHibernate\Impl\SessionImpl.cs:line 2596
at NHibernate.Impl.SessionImpl.InternalLoad(Type clazz, Object id, Boolean eager, Boolean isNullable) in F:\NHibernate-1.2.0.Beta2-debug\src\NHibernate\Impl\SessionImpl.cs:line 2500
at NHibernate.Type.EntityType.ResolveIdentifier(Object id, ISessionImplementor session) in F:\NHibernate-1.2.0.Beta2-debug\src\NHibernate\Type\EntityType.cs:line 259
at NHibernate.Type.EntityType.ResolveIdentifier(Object id, ISessionImplementor session, Object owner) in F:\NHibernate-1.2.0.Beta2-debug\src\NHibernate\Type\EntityType.cs:line 279
at NHibernate.Impl.SessionImpl.InitializeEntity(Object obj) in F:\NHibernate-1.2.0.Beta2-debug\src\NHibernate\Impl\SessionImpl.cs:line 2952
at NHibernate.Loader.Loader.InitializeEntitiesAndCollections(IList hydratedObjects, Object resultSetId, ISessionImplementor session) in F:\NHibernate-1.2.0.Beta2-debug\src\NHibernate\Loader\Loader.cs:line 584
at NHibernate.Loader.Loader.DoQuery(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies) in F:\NHibernate-1.2.0.Beta2-debug\src\NHibernate\Loader\Loader.cs:line 452
at NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies) in F:\NHibernate-1.2.0.Beta2-debug\src\NHibernate\Loader\Loader.cs:line 183
at NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters queryParameters) in F:\NHibernate-1.2.0.Beta2-debug\src\NHibernate\Loader\Loader.cs:line 1757
at NHibernate.Loader.Loader.ListIgnoreQueryCache(ISessionImplementor session, QueryParameters queryParameters) in F:\NHibernate-1.2.0.Beta2-debug\src\NHibernate\Loader\Loader.cs:line 1705
at NHibernate.Loader.Loader.List(ISessionImplementor session, QueryParameters queryParameters, ISet querySpaces, IType[] resultTypes) in F:\NHibernate-1.2.0.Beta2-debug\src\NHibernate\Loader\Loader.cs:line 1699
at NHibernate.Hql.Classic.QueryTranslator.List(ISessionImplementor session, QueryParameters queryParameters) in F:\NHibernate-1.2.0.Beta2-debug\src\NHibernate\Hql\Classic\QueryTranslator.cs:line 1008
at NHibernate.Impl.SessionImpl.Find(String query, QueryParameters parameters, IList results) in F:\NHibernate-1.2.0.Beta2-debug\src\NHibernate\Impl\SessionImpl.cs:line 1810
at NHibernate.Impl.SessionImpl.Find(String query, QueryParameters parameters) in F:\NHibernate-1.2.0.Beta2-debug\src\NHibernate\Impl\SessionImpl.cs:line 1770
at NHibernate.Impl.QueryImpl.List() in F:\NHibernate-1.2.0.Beta2-debug\src\NHibernate\Impl\QueryImpl.cs:line 57
at SimpleTestProject.Program.Main(String[] args) in F:\Sources\STGQ\SimpleTestProject\Program.cs:line 39
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()