I am implementing a level 2 caching strategy in an application.  All of my 
entities work as expected without the use of an L2 cache.  However since 
implementing the L2 cache, I am periodically getting the following 
exception when retrieving an entity from the cache:

[InvalidCastException: Unable to cast object of type 
'NHibernate.Cache.Entry.CacheEntry' to type 'ILockable'.]
   NHibernate.Cache.ReadWriteCache.Get(CacheKey key, Int64 txTimestamp) +182
   NHibernate.Event.Default.DefaultLoadEventListener.
LoadFromSecondLevelCache(LoadEvent event, IEntityPersister persister, 
LoadType options) +401
   NHibernate.Event.Default.DefaultLoadEventListener.DoLoad(LoadEvent event, 
IEntityPersister persister, EntityKey keyToLoad, LoadType options) +508
   NHibernate.Event.Default.DefaultLoadEventListener.Load(LoadEvent event, 
IEntityPersister persister, EntityKey keyToLoad, LoadType options) +181
   NHibernate.Event.Default.DefaultLoadEventListener.OnLoad(LoadEvent event, 
LoadType loadType) +525
   NHibernate.Impl.SessionImpl.FireLoad(LoadEvent event, LoadType loadType) 
+402
   NHibernate.Impl.SessionImpl.ImmediateLoad(String entityName, Object id) +
445
   NHibernate.Proxy.AbstractLazyInitializer.Initialize() +122
   NHibernate.Proxy.DefaultLazyInitializer.Intercept(InvocationInfo info) +
125

This seems to be happening fairly randomly with different entities.  Again, 
if I disable or clear the L2 cache the error goes away.  So what I am doing 
wrong?

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.

Reply via email to