Description
Version: 5.2.4
We're having an issue with creating projections (with Linq's Select()
) of entities where one of the properties is a one-to-one map.
I've created a repro.
Expected result: Results
is not null in both cases.
Actual result: Results
is null in the first case (with the Select() projection), but in the second case (plain query) it's a correct, non-null object.
(We're using FluentNHibernate to generate the mappings, but the <one-to-one />
mapping lines look fine in the generated XML.)
So far I've found out that NHibernate.Type.OneToOneType.Hydrate()
is called twice each time, and the owner
parameter has these values:
- First example (Select()):
- First call: a
Results
object - Second call:
null
- First call: a
- Second example (plain query):
- First call: an
Owner
object - Second call: a
Results
object
- First call: an
Might a part of issue be that owner
is null at one point, and thus Hydrate
's return value is null as well, leading a method further down the call stack to believe the object to be null?