ProxyWarnLog

200 views
Skip to first unread message

Jan Limpens

unread,
Jun 25, 2009, 3:24:53 PM6/25/09
to nhusers
I am getting this:

2009-06-25 16:20:46,030 [8] WARN  NHibernate.Engine.StatefulPersistenceContext.ProxyWarnLog - Narrowing proxy to Fex.Businesslayer.ProductSet - this operation breaks ==

What does this mean?

--
Jan

Tuna Toksoz

unread,
Jun 25, 2009, 3:26:10 PM6/25/09
to nhu...@googlegroups.com
You have a reference to a base class, but when loaded, it becomes the super class, it is narrowed.

Tuna Toksöz
Eternal sunshine of the open source mind.

http://devlicio.us/blogs/tuna_toksoz
http://tunatoksoz.com
http://twitter.com/tehlike

Fabio Maulo

unread,
Jun 25, 2009, 3:29:10 PM6/25/09
to nhu...@googlegroups.com
/// <summary> 
/// If the existing proxy is insufficiently "narrow" (derived), instantiate a new proxy
/// and overwrite the registration of the old one. This breaks == and occurs only for
/// "class" proxies rather than "interface" proxies. Also init the proxy to point to
/// the given target implementation if necessary. 
/// </summary>
/// <param name="proxy">The proxy instance to be narrowed. </param>
/// <param name="persister">The persister for the proxied entity. </param>
/// <param name="key">The internal cache key for the proxied entity. </param>
/// <param name="obj">(optional) the actual proxied entity instance. </param>
/// <returns> An appropriately narrowed instance. </returns>
public object NarrowProxy(INHibernateProxy proxy, IEntityPersister persister, EntityKey key, object obj)


2009/6/25 Jan Limpens <jan.l...@gmail.com>



--
Fabio Maulo

Jan Limpens

unread,
Jun 25, 2009, 3:54:05 PM6/25/09
to nhu...@googlegroups.com
How does this happen? (I just get the warning, but don't actually know what causes it, so I need to understand the context better)
Overall it does not seem as a very terrible thing...

2009/6/25 Fabio Maulo <fabio...@gmail.com>



--
Jan

Fabio Maulo

unread,
Jun 25, 2009, 5:31:11 PM6/25/09
to nhu...@googlegroups.com
For sure is not terrible (for some reason it is a "warning" and not an "error" ;) ).
To understand when and why we should see which the code running in a opened session and I'm pretty sure that it is not so easy to find where the same entity-proxy is requested for two different classes in the same hierarchy.

2009/6/25 Jan Limpens <jan.l...@gmail.com>



--
Fabio Maulo

Ocsam

unread,
Aug 10, 2012, 5:41:14 AM8/10/12
to nhu...@googlegroups.com
I ran into this issue because i was used an abstract base class instead of an interface. And after digging into the source, i am wondering if a check for abstract classes should not also be made.

/// <summary>
/// If the existing proxy is insufficiently "narrow" (derived), instantiate a new proxy
/// and overwrite the registration of the old one. This breaks == and occurs only for
/// "class" proxies rather than "interface" proxies. Also init the proxy to point to
/// the given target implementation if necessary.
/// </summary>
/// <param name="proxy">The proxy instance to be narrowed. </param>
/// <param name="persister">The persister for the proxied entity. </param>
/// <param name="key">The internal cache key for the proxied entity. </param>
/// <param name="obj">(optional) the actual proxied entity instance. </param>
/// <returns> An appropriately narrowed instance. </returns>
public object NarrowProxy(INHibernateProxy proxy, IEntityPersister persister, EntityKey key, object obj)
{
            bool alreadyNarrow = persister.GetConcreteProxyClass(session.EntityMode).IsAssignableFrom(proxy.GetType()) && !persister.GetConcreteProxyClass(session.EntityMode).IsAbstract;

what do you think?  
Thanks in advance

Reply all
Reply to author
Forward
0 new messages