Skip to content

Commit ac14311

Browse files
Merge 5.3.16 into 5.4.x
2 parents de2d941 + 342c01f commit ac14311

File tree

7 files changed

+42
-9
lines changed

7 files changed

+42
-9
lines changed

releasenotes.txt

+17
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,23 @@ Release notes - NHibernate - Version 5.4.0
209209
* #2242 Test case for NH-3972 - SQL error when selecting a column of a subclass when sibling classes have a column of the same name
210210

211211

212+
Build 5.3.16
213+
=============================
214+
215+
Release notes - NHibernate - Version 5.3.16
216+
217+
3 issues were resolved in this release.
218+
219+
** Bug
220+
221+
* #3269 "Or" clause in a "where" condition returns a wrong result with not-found-ignore
222+
* #3210 Wrong name value for L2 read-only cache warning on mutable
223+
224+
** Task
225+
226+
* #3276 Release 5.3.16
227+
228+
212229
Build 5.3.15
213230
=============================
214231

src/NHibernate.Test/Async/Hql/EntityJoinHqlTest.cs

+9
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,15 @@ from x2 in session.Query<NullableOwner>()
358358
//GH-2988
359359
var withNullOrValidList = await (session.Query<NullableOwner>().Where(x => x.ManyToOne.Id == validManyToOne.Id || x.ManyToOne == null).ToListAsync());
360360
var withNullOrValidList2 = await (session.Query<NullableOwner>().Where(x => x.ManyToOne == null || x.ManyToOne.Id == validManyToOne.Id).ToListAsync());
361+
//GH-3269
362+
var invalidId = Guid.NewGuid();
363+
var withInvalidOrValid = await (session.Query<NullableOwner>().Where(x => x.OneToOne.Id == invalidId || x.ManyToOne.Id == validManyToOne.Id).ToListAsync());
364+
var withInvalidOrNull = await (session.Query<NullableOwner>().Where(x => x.ManyToOne.Id == invalidId || x.OneToOne == null).ToListAsync());
365+
var withInvalidOrNotNull = await (session.Query<NullableOwner>().Where(x => x.ManyToOne.Id == invalidId || x.OneToOne != null).ToListAsync());
366+
367+
Assert.That(withInvalidOrValid.Count, Is.EqualTo(1));
368+
Assert.That(withInvalidOrNull.Count, Is.EqualTo(2));
369+
Assert.That(withInvalidOrNotNull.Count, Is.EqualTo(0));
361370

362371
//GH-3185
363372
var mixImplicitAndLeftJoinList = await (session.Query<NullableOwner>().Where(x => x.ManyToOne.Id == validManyToOne.Id && x.OneToOne == null).ToListAsync());

src/NHibernate.Test/Hql/EntityJoinHqlTest.cs

+9
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,15 @@ from x2 in session.Query<NullableOwner>()
346346
//GH-2988
347347
var withNullOrValidList = session.Query<NullableOwner>().Where(x => x.ManyToOne.Id == validManyToOne.Id || x.ManyToOne == null).ToList();
348348
var withNullOrValidList2 = session.Query<NullableOwner>().Where(x => x.ManyToOne == null || x.ManyToOne.Id == validManyToOne.Id).ToList();
349+
//GH-3269
350+
var invalidId = Guid.NewGuid();
351+
var withInvalidOrValid = session.Query<NullableOwner>().Where(x => x.OneToOne.Id == invalidId || x.ManyToOne.Id == validManyToOne.Id).ToList();
352+
var withInvalidOrNull = session.Query<NullableOwner>().Where(x => x.ManyToOne.Id == invalidId || x.OneToOne == null).ToList();
353+
var withInvalidOrNotNull = session.Query<NullableOwner>().Where(x => x.ManyToOne.Id == invalidId || x.OneToOne != null).ToList();
354+
355+
Assert.That(withInvalidOrValid.Count, Is.EqualTo(1));
356+
Assert.That(withInvalidOrNull.Count, Is.EqualTo(2));
357+
Assert.That(withInvalidOrNotNull.Count, Is.EqualTo(0));
349358

350359
//GH-3185
351360
var mixImplicitAndLeftJoinList = session.Query<NullableOwner>().Where(x => x.ManyToOne.Id == validManyToOne.Id && x.OneToOne == null).ToList();

src/NHibernate/Hql/Ast/ANTLR/HqlSqlWalker.cs

-3
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ public partial class HqlSqlWalker
4343
private SelectClause _selectClause;
4444
private readonly AliasGenerator _aliasGenerator = new AliasGenerator();
4545
private readonly ASTPrinter _printer = new ASTPrinter();
46-
private bool _isNullComparison;
4746

4847
//
4948
//Maps each top-level result variable to its SelectExpression;
@@ -1318,8 +1317,6 @@ public IASTFactory ASTFactory
13181317
}
13191318
}
13201319

1321-
internal bool IsNullComparison => _isNullComparison;
1322-
13231320
public void AddQuerySpaces(IEntityPersister persister)
13241321
{
13251322
AddPersister(persister);

src/NHibernate/Hql/Ast/ANTLR/HqlSqlWalker.g

+1-1
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ comparisonExpr
391391
| ^(NOT_BETWEEN exprOrSubquery exprOrSubquery exprOrSubquery)
392392
| ^(IN exprOrSubquery inRhs )
393393
| ^(NOT_IN exprOrSubquery inRhs )
394-
| ^(IS_NULL { _isNullComparison = true; } exprOrSubquery { _isNullComparison = false; })
394+
| ^(IS_NULL exprOrSubquery)
395395
| ^(IS_NOT_NULL exprOrSubquery)
396396
// | ^(IS_TRUE expr)
397397
// | ^(IS_FALSE expr)

src/NHibernate/Hql/Ast/ANTLR/Tree/DotNode.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -426,8 +426,7 @@ private void DereferenceEntity(EntityType entityType, bool implicitJoin, string
426426

427427
if ( joinIsNeeded )
428428
{
429-
var forceLeftJoin = comparisonWithNullableEntity && Walker.IsNullComparison;
430-
DereferenceEntityJoin(classAlias, entityType, implicitJoin, parent, forceLeftJoin);
429+
DereferenceEntityJoin(classAlias, entityType, implicitJoin, parent, comparisonWithNullableEntity);
431430
if (comparisonWithNullableEntity)
432431
{
433432
_columns = FromElement.GetIdentityColumns();

src/NHibernate/Impl/SessionFactoryImpl.cs

+5-3
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: {0}", entityName);
483485

484486
return cache;
485487
}

0 commit comments

Comments
 (0)