Nhibernate 3.1 and many-to-one laziness no-proxy

357 views
Skip to first unread message

Rico

unread,
Jun 10, 2011, 8:38:50 AM6/10/11
to nhusers
Hi, is there any known trouble about Nhibernate 3.1 and no-proxy
laziness?
I moved from Nhibernate 2.1.2.4000 to 3.1.4000 and with a mapping like
this one:

<?xml version="1.0" encoding="utf-8"?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
namespace="myNamespace" assembly="myAssembly">
<class name="Comment" table="comments_tb">
<id name="Id" column="idComment" unsaved-value="0">
<generator class="native" />
</id>
<property name="isEnabled" column="isEnabled" access="field"/>
<many-to-one name="Post" lazy="no-proxy"/>
</class>
</hibernate-mapping>

When I try
session.CreateCriteria(myClassMetaData.Value.GetMappedClass(EntityMode.Poco)).SetMaxResults(1).List()
i get NHibernate.Exceptions.GenericADOException: could not execute
query
[...the query...]
---> System.NotSupportedException: Specified method is not supported.

stacktrace:

NHibernate.Proxy.AbstractProxyFactory.GetFieldInterceptionProxy()
NHibernate.Tuple.PocoInstantiator.Instantiate()
NHibernate.Tuple.PocoInstantiator.Instantiate(Object id)
NHibernate.Tuple.Entity.AbstractEntityTuplizer.Instantiate(Object id)
NHibernate.Persister.Entity.AbstractEntityPersister.Instantiate(Object
id, EntityMode entityMode)
NHibernate.Impl.SessionImpl.Instantiate(IEntityPersister persister,
Object id)
NHibernate.Impl.SessionImpl.Instantiate(String clazz, Object id)
NHibernate.Loader.Loader.InstanceNotYetLoaded(IDataReader dr, Int32 i,
ILoadable persister, EntityKey key, LockMode lockMode, String
rowIdAlias, EntityKey optionalObjectKey, Object optionalObject, IList
hydratedObjects, ISessionImplementor session)
NHibernate.Loader.Loader.GetRow(IDataReader rs, ILoadable[]
persisters, EntityKey[] keys, Object optionalObject, EntityKey
optionalObjectKey, LockMode[] lockModes, IList hydratedObjects,
ISessionImplementor session)
NHibernate.Loader.Loader.GetRowFromResultSet(IDataReader resultSet,
ISessionImplementor session, QueryParameters queryParameters,
LockMode[] lockModeArray, EntityKey optionalObjectKey, IList
hydratedObjects, EntityKey[] keys, Boolean returnProxies)
NHibernate.Loader.Loader.DoQuery(ISessionImplementor session,
QueryParameters queryParameters, Boolean returnProxies)
NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor
session, QueryParameters queryParameters, Boolean returnProxies)
NHibernate.Loader.Loader.DoList(ISessionImplementor session,
QueryParameters queryParameters)
NHibernate.Loader.Loader.DoList(ISessionImplementor session,
QueryParameters queryParameters)
NHibernate.Loader.Loader.ListIgnoreQueryCache(ISessionImplementor
session, QueryParameters queryParameters)
NHibernate.Loader.Loader.List(ISessionImplementor session,
QueryParameters queryParameters, ISet`1 querySpaces, IType[]
resultTypes)
NHibernate.Impl.SessionImpl.List(CriteriaImpl criteria, IList results)
NHibernate.Impl.CriteriaImpl.List(IList results)
NHibernate.Impl.CriteriaImpl.List()

With Nh version 2.1.2.4000 it worked fine and I've noticed that
changing the laziness attribute there aren't any issues and it looks
like related to Linfu bytecode provider.
Any Idea?

Thanks in advance

Riccardo

Fabio Maulo

unread,
Jun 11, 2011, 2:15:03 PM6/11/11
to nhu...@googlegroups.com
in NH2.x lazy="no-proxy" is identical to lazy="false".
Since NH3 lazy="no-proxy" has a specific meaning.

You have to fix your mapping using lazy="false" 

Rico

unread,
Jun 13, 2011, 11:55:30 AM6/13/11
to nhusers
Thanks you for the answer, my goal is to use the no-proxy feature
without get the 'NotSupportedException' from Linfu. I was wondering if
use a different byteCode provider, could it be a solution?

Fabio Maulo

unread,
Jun 14, 2011, 7:44:56 AM6/14/11
to nhu...@googlegroups.com
For NH3.0 and NH3.1 you can use Castle.

Rico

unread,
Jun 16, 2011, 10:27:28 AM6/16/11
to nhusers
Castle implementation looks like to work, does it mean that Linfu
doesn't support NH 3.0 and over for now?

Berke Sokhan

unread,
Jun 16, 2011, 10:44:12 AM6/16/11
to nhu...@googlegroups.com
AFAIK, they merged LinFu to NH3.2 binary and get rid of any other runtime proxy providers. So you wont be needing "Required_For_LazyLoading" dlls from NH 3.2 on..

2011/6/16 Rico <riccardo....@gmail.com>
--
You received this message because you are subscribed to the Google Groups "nhusers" group.
To post to this group, send email to nhu...@googlegroups.com.
To unsubscribe from this group, send email to nhusers+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.




--
Berke SOKHAN.

http://twitter.com/berkesokhan
http://blog.berkesokhan.com
http://www.birliktegelistir.com/editors.aspx

Fabio Maulo

unread,
Jun 17, 2011, 7:23:06 PM6/17/11
to nhu...@googlegroups.com
something like that
Reply all
Reply to author
Forward
0 new messages