Skip to content

Commit ac5abac

Browse files
committed
Add entity name for mutable read-only cache log
1 parent a90a45c commit ac5abac

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/NHibernate/Impl/SessionFactoryImpl.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,7 @@ public SessionFactoryImpl(Configuration cfg, IMapping mapping, Settings settings
277277
model.RootClazz.CacheRegionName,
278278
model.CacheConcurrencyStrategy,
279279
model.IsMutable,
280+
model.EntityName,
280281
caches);
281282
var cp = PersisterFactory.CreateClassPersister(model, cache, this, mapping);
282283
entityPersisters[model.EntityName] = cp;
@@ -302,6 +303,7 @@ public SessionFactoryImpl(Configuration cfg, IMapping mapping, Settings settings
302303
model.CacheRegionName,
303304
model.CacheConcurrencyStrategy,
304305
model.Owner.IsMutable,
306+
model.OwnerEntityName,
305307
caches);
306308
var persister = PersisterFactory.CreateCollectionPersister(model, cache, this);
307309
collectionPersisters[model.Role] = persister;
@@ -463,10 +465,10 @@ private IQueryCache BuildQueryCache(string queryCacheName)
463465
properties);
464466
}
465467

466-
private ICacheConcurrencyStrategy GetCacheConcurrencyStrategy(
467-
string cacheRegion,
468+
private ICacheConcurrencyStrategy GetCacheConcurrencyStrategy(string cacheRegion,
468469
string strategy,
469470
bool isMutable,
471+
string entityName,
470472
Dictionary<Tuple<string, string>, ICacheConcurrencyStrategy> caches)
471473
{
472474
if (strategy == null || strategy == CacheFactory.Never || !settings.IsSecondLevelCacheEnabled)
@@ -479,7 +481,7 @@ private ICacheConcurrencyStrategy GetCacheConcurrencyStrategy(
479481
cache = CacheFactory.CreateCache(strategy, GetCache(cacheRegion), settings);
480482
caches.Add(cacheKey, cache);
481483
if (isMutable && strategy == CacheFactory.ReadOnly)
482-
log.Warn("read-only cache configured for mutable: {0}", name);
484+
log.Warn("read-only cache configured for mutable entity `{0}` in session factory `{1}`", entityName, name );
483485

484486
return cache;
485487
}

0 commit comments

Comments
 (0)