Skip to content

Unable to correctly resolve the owner key with null value property #1983

@neseih

Description

@neseih

Since NHibernate version 5.2 (commit: 8124cb5) GetKeyOfOwner in CollectionType.cs throws an exception if the property value (in the database) is null.

Exception:

AssertionFailure: Unable to correctly resolve the owner key, property Property for collection SomeChildrenList.
Unresolved value '', key type 'NHibernate.Type.StringType', owner 'Example.SomeEntity'

Mapping (Example.SomeEntity):

mapping.HasMany(m => m.SomeChildrenList)
.PropertyRef("Property")     // Type: String, can be null
.KeyColumns.Add("ReferencedProperty")
.NotFound.Ignore();

There is no ForeignKeyConstraint on Property and ReferencedProperty and both properties are not keys.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions