Skip to content

Commit a925c58

Browse files
authored
Add entity name to mutable read-only cache warning log (nhibernate#3268)
Fixes nhibernate#3210
1 parent 7deea30 commit a925c58

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/NHibernate/Impl/SessionFactoryImpl.cs

+5-3
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ public SessionFactoryImpl(Configuration cfg, IMapping mapping, Settings settings
270270
model.RootClazz.CacheRegionName,
271271
model.CacheConcurrencyStrategy,
272272
model.IsMutable,
273+
model.EntityName,
273274
caches);
274275
var cp = PersisterFactory.CreateClassPersister(model, cache, this, mapping);
275276
entityPersisters[model.EntityName] = cp;
@@ -290,6 +291,7 @@ public SessionFactoryImpl(Configuration cfg, IMapping mapping, Settings settings
290291
model.CacheRegionName,
291292
model.CacheConcurrencyStrategy,
292293
model.Owner.IsMutable,
294+
model.OwnerEntityName,
293295
caches);
294296
var persister = PersisterFactory.CreateCollectionPersister(model, cache, this);
295297
collectionPersisters[model.Role] = persister;
@@ -446,10 +448,10 @@ private IQueryCache BuildQueryCache(string queryCacheName)
446448
properties);
447449
}
448450

449-
private ICacheConcurrencyStrategy GetCacheConcurrencyStrategy(
450-
string cacheRegion,
451+
private ICacheConcurrencyStrategy GetCacheConcurrencyStrategy(string cacheRegion,
451452
string strategy,
452453
bool isMutable,
454+
string entityName,
453455
Dictionary<Tuple<string, string>, ICacheConcurrencyStrategy> caches)
454456
{
455457
if (strategy == null || !settings.IsSecondLevelCacheEnabled)
@@ -462,7 +464,7 @@ private ICacheConcurrencyStrategy GetCacheConcurrencyStrategy(
462464
cache = CacheFactory.CreateCache(strategy, GetCache(cacheRegion), settings);
463465
caches.Add(cacheKey, cache);
464466
if (isMutable && strategy == CacheFactory.ReadOnly)
465-
log.Warn("read-only cache configured for mutable: {0}", name);
467+
log.Warn("read-only cache configured for mutable: {0}", entityName);
466468

467469
return cache;
468470
}

0 commit comments

Comments
 (0)