session load exception with enableFilter

Description

demo explain:
The BaseOn property of Pricelist is also a Pricelist class, but its property is null.

session.EnableFilter("tenant").SetParameter("id", tenantId);
session.Load<Pricelist>(pricelistId);
output:
NHibernate.Test.NHSpecificTest.NH1234.SampleTest.ShouldBeLoadedWithoutException:
NHibernate.ObjectNotFoundException : No row with the given identifier exists[NHibernate.Test.NHSpecificTest.NH1234.Pricelist#1]
---------------------------------------------------------------------------------------
EXPECTED:
SELECT pricelist0_.ID as ID0_2_, pricelist0_.TENANT_ID as TENANT2_0_2_, pricelist0_.BASED_ON as BASED3_0_2_,
pricelist0_.NAME as NAME0_2_, pricelist0_.PRECISION as PRECISION0_2_, pricelist0_.IS_ACTIVE as IS6_0_2_,
tenant1_.ID as ID1_0_, tenant1_.NAME as NAME1_0_, tenant1_.BASE_URL as BASE3_1_0_, tenant1_.TITLE as TITLE1_0_,
tenant1_.THEME as THEME1_0_, pricelist2_.ID as ID0_1_, pricelist2_.TENANT_ID as TENANT2_0_1_,
pricelist2_.BASED_ON as BASED3_0_1_, pricelist2_.NAME as NAME0_1_, pricelist2_.PRECISION as PRECISION0_1_, pricelist2_.IS_ACTIVE as IS6_0_1_
FROM Pricelists pricelist0_
inner join Tenants tenant1_ on pricelist0_.TENANT_ID=tenant1_.ID
left outer join Pricelists pricelist2_ on pricelist0_.BASED_ON=pricelist2_.ID and pricelist2_.TENANT_ID = @p0
WHERE tenant1_.ID = @p0 AND pricelist0_.ID=@p2;@p0 = 1 [Type: Int64 (0)], @p2 = 1 [Type: Int64 (0)]

BUT:
SELECT pricelist0_.ID as ID0_2_, pricelist0_.TENANT_ID as TENANT2_0_2_, pricelist0_.BASED_ON as BASED3_0_2_,
pricelist0_.NAME as NAME0_2_, pricelist0_.PRECISION as PRECISION0_2_, pricelist0_.IS_ACTIVE as IS6_0_2_,
tenant1_.ID as ID1_0_, tenant1_.NAME as NAME1_0_, tenant1_.BASE_URL as BASE3_1_0_, tenant1_.TITLE as TITLE1_0_,
tenant1_.THEME as THEME1_0_, pricelist2_.ID as ID0_1_, pricelist2_.TENANT_ID as TENANT2_0_1_,
pricelist2_.BASED_ON as BASED3_0_1_, pricelist2_.NAME as NAME0_1_, pricelist2_.PRECISION as PRECISION0_1_, pricelist2_.IS_ACTIVE as IS6_0_1_
FROM Pricelists pricelist0_
inner join Tenants tenant1_ on pricelist0_.TENANT_ID=tenant1_.ID
left outer join Pricelists pricelist2_ on pricelist0_.BASED_ON=pricelist2_.ID
WHERE tenant1_.ID = @p0 and pricelist2_.TENANT_ID = @p0 AND pricelist0_.ID=@p2;@p0 = 1 [Type: Int64 (0)], @p2 = 1 [Type: Int64 (0)]

Environment

None

Assignee

Alex Zaytsev

Reporter

gaudi

Labels

Components

Affects versions

Priority

Major
Configure