Hello,
I'm testing nhibernate with mono and I have problems when I turn lazy="true".
If I define an interface for proxy lazy recuperation runs ok, but, if I define public members as virtual, and don't define proxy interface, then hibernate crash in a many-to-one relation with this error:
-------------------------------------------------------------------------------
Unhandled Exception: NHibernate.HibernateException: Creating a proxy instance failed ---> System.NullReferenceException: Object reference not set to an instance of an object
in <0x00088> Castle.DynamicProxy.Builder.CodeBuilder.EasyType:IsAssemblySigned (System.Type baseType)
in <0x00032> Castle.DynamicProxy.Builder.CodeBuilder.EasyType:.ctor (Castle.DynamicProxy.Builder.CodeGenerators.ModuleScope modulescope, System.String name, System.Type baseType, System.Type[] interfaces, Boolean serializable)
in <0x0003e> Castle.DynamicProxy.Builder.CodeGenerators.BaseCodeGenerator:CreateTypeBuilder (System.String typeName, System.Type baseType, System.Type[] interfaces)
in <0x000e6> Castle.DynamicProxy.Builder.CodeGenerators.ClassProxyGenerator:GenerateCode (System.Type baseClass, System.Type[] interfaces)
in <0x00033> Castle.DynamicProxy.Builder.DefaultProxyBuilder:CreateClassProxy (System.Type theClass, System.Type[] interfaces)
in <0x00061> Castle.DynamicProxy.ProxyGenerator:CreateClassProxy (System.Type baseClass, System.Type[] interfaces, IInterceptor interceptor, Boolean checkAbstract, System.Object[] argumentsForConstructor)
in <0x00085> NHibernate.Proxy.CastleProxyFactory:GetProxy (System.Object id, ISessionImplementor session)--- End of inner exception stack trace ---
in <0x001e3> NHibernate.Proxy.CastleProxyFactory:GetProxy (System.Object id, ISessionImplementor session)
in <0x00020> NHibernate.Persister.AbstractEntityPersister:CreateProxy (System.Object id, ISessionImplementor session)
in <0x001a0> NHibernate.Impl.SessionImpl:DoLoadByClass (System.Type clazz, System.Object id, Boolean checkDeleted, Boolean allowProxyCreation)
in <0x0001a> NHibernate.Impl.SessionImpl:InternalLoad (System.Type clazz, System.Object id)
in <0x00032> NHibernate.Type.ManyToOneType:ResolveIdentifier (System.Object id, ISessionImplementor session)
in <0x00030> NHibernate.Type.EntityType:ResolveIdentifier (System.Object id, ISessionImplementor session, System.Object owner)
in <0x0011b> NHibernate.Impl.SessionImpl:InitializeEntity (System.Object obj)
in <0x000c0> NHibernate.Loader.Loader:InitializeEntitiesAndCollections (IList hydratedObjects, System.Object resultSetId, ISessionImplementor session)
in <0x00316> NHibernate.Loader.Loader:DoQuery (ISessionImplementor session, NHibernate.Engine.QueryParameters queryParameters, System.Object optionalObject, System.Object optionalId, System.Object[] optionalCollectionKeys, Boolean returnProxies)
in <0x0003a> NHibernate.Loader.Loader:DoQueryAndInitializeNonLazyCollections (ISessionImplementor session, NHibernate.Engine.QueryParameters queryParameters, System.Object optionalObject, System.Object optionalId, System.Object[] optionalCollectionKeys, Boolean returnProxies)
in <0x0003d> NHibernate.Loader.Loader:LoadEntity (ISessionImplementor session, System.Object[] values, NHibernate.Type.IType[] types, System.Object optionalObject, System.Object optionalID)
in <0x0007e> NHibernate.Loader.Loader:LoadEntity (ISessionImplementor session, System.Object id, IType identifierType, System.Object optionalObject, System.Object optionalIdentifier)
in <0x00028> NHibernate.Loader.EntityLoader:Load (ISessionImplementor session, System.Object id, System.Object optionalObject, System.Object optionalId)
in <0x00019> NHibernate.Loader.EntityLoader:Load (ISessionImplementor session, System.Object id, System.Object optionalObject)
in <0x00197> NHibernate.Persister.EntityPersister:Load (System.Object id, System.Object optionalObject, NHibernate.LockMode lockMode, ISessionImplementor session)
-------------------------------------------------------------------------------
Mono: 1.1.13.2
NHibernate: 1.0.2
Database: PostgreSQL 8.1
In the other hand, with MS .NET, for the same project, lazy recuperation works fine in all situations.
Some idea?, the problem is mono?
Thanks in advance,
|