Skip to content

Property-ref on many-to-one with composite id fails #1918

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

RogerKratz
Copy link
Contributor

@RogerKratz RogerKratz commented Dec 3, 2018

NHibernate fails loading an entity when it has a many-to-one which use a composite-id foreign key and is referenced by a property-ref.

Regression bug. Didn't exist in 5.1.x.

Found it when I upgrading Envers project to use NH Core 5.2 => similar test fails there as well now.

@fredericDelaporte
Copy link
Member

It is likely to be caused by #1872.

@fredericDelaporte
Copy link
Member

#1872 has introduced a call to SemiResolve, which causes the casting failure on the many-to-one property, and has following code:

//note that this implementation is kinda broken
//for components with many-to-one associations
return ResolveIdentifier(value, session, owner);

It does not tell what is the trouble, but maybe that is what causes the failure here and has to be fixed. I am checking this.

@fredericDelaporte
Copy link
Member

I have pushed the reviewed changes, and I have added a fix.

@fredericDelaporte fredericDelaporte added this to the 5.2.1 milestone Dec 6, 2018
@fredericDelaporte fredericDelaporte changed the title Loading bidirectional one-to-one with embedded id fails Property-ref on many-to-one with composite id fails Dec 6, 2018
@fredericDelaporte
Copy link
Member

fredericDelaporte commented Dec 6, 2018

I have updated the title and description for more closely matching the actual issue. This issue is not specific to one-to-one.

@fredericDelaporte fredericDelaporte merged commit 6f38e13 into nhibernate:master Dec 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants