-
Notifications
You must be signed in to change notification settings - Fork 934
Fix property-ref on a component's property #1871
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
Fix property-ref on a component's property #1871
Conversation
@@ -221,7 +221,7 @@ public string GetIdentifierPropertyName(string className) | |||
public IType GetReferencedPropertyType(string className, string propertyName) | |||
{ | |||
PersistentClass pc = GetPersistentClass(className); | |||
Property prop = pc.GetProperty(propertyName); | |||
Property prop = pc.GetReferencedProperty(propertyName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GetProperty
yields properties of the entity, it does not go inside components for yielding the component property.
@fredericDelaporte why does it show my name on the tests? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks correct
@fredericDelaporte can you check if #1214 is related? |
Because I have cherry-pick from your 4431485, squashed in it bab942a, then renamed the files and added the property triggering the failure and added a non-dynamic component for allowing checking it was also having the trouble.
I tend to think no, but I will check the test case. Update: the test case (90b9596) fails completely. It looks like some unrelated regression on property ref with many-to-many has happened since the test case was done. |
#378 (NH v4.1, NH-3480) has broken #1214 case, which hinders me for diagnosing it. Reverting #378 by keeping only the Update: a commit message has mislead me, mentioning #211 instead of #378 which has replaced it. |
Ok. Any reasons not to merge yet? |
#1214 root cause is a mapping error: using a property-ref on a property not flagged as unique. But NHibernate does not detect this error when validating mappings, and do not raise a good error when attempting to resolve an entity by an undeclared unique key. Update: flagging the property as unique changes nothing, because that is not what uses NHibernate for enabling lookup by unique key. So it is not an user error in mapping, but a bug in NHibernate which should have flagged |
Fixes #1824