Skip to content

One-to-one properties not appearing in Select() projection result set #2064

Closed
@jhinder

Description

@jhinder

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
  • Second example (plain query):
    • First call: an Owner object
    • Second call: a Results object

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?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions