Skip to content

NH-3634 - Fix comparing property to component with nullable properties in Criteria/QueryOver #390

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
merged 1 commit into from
May 13, 2015

Conversation

jlevitt
Copy link
Contributor

@jlevitt jlevitt commented Dec 24, 2014

📙 Ready for code review

Description

Test case and fix for NH-3634.

Please do a thorough code review. I'm new to the NHB code base, and I'm not entirely sure that this was the best place to make the fix.

Todo

  • Add test where component only has one property and case is ignored. If fails, fix (in SimpleExpression). This case is broken, but not related to NH-3634.
  • Verify it is ok to implement MetaType.ToColumnNullness
  • Fix ignored test: AnyIs_QueryOver
  • Fix ignored test: EachEmbeddedBasicTypeIsSerializable

Code Review Questions

  • The if (ignoreCase) code path in SimpleExpression.ToSqlString seems broken. What if this is applied to a component with a single property. Because of object icvalue = ignoreCase ? value.ToString().ToLower() : value; in GetParameterTypedValue the compared value will be changed from the component object to a string. This is broken. Maybe it doesn't matter, because it's a edge case, but it might be indicitive of a larger problem around handling case insensitivity for SimpleExpression. I won't attempt to fix as part of this pull request unless asked to.
  • Is it ok to implement MetaType.ToColumnNullness here? I couldn't see any reason not to, and it didn't fail any tests.

@jlevitt
Copy link
Contributor Author

jlevitt commented Dec 31, 2014

Ready for code review

@hazzik
Copy link
Member

hazzik commented Dec 31, 2014

Could you please add tests for second level cache?

@jlevitt
Copy link
Contributor Author

jlevitt commented Dec 31, 2014

@hazzik Sure thing. Do you want query cache, entity cache or both?

@jlevitt
Copy link
Contributor Author

jlevitt commented Dec 31, 2014

@hazzik Second-level cache test added. Are there any other cases I've missed?

@jlevitt
Copy link
Contributor Author

jlevitt commented Jan 31, 2015

@hazzik I just pushed 2 more tests which I believe are more inline with what you were asking for. Sorry for the delay!

@hazzik hazzik added this to the 4.1.0 milestone Feb 9, 2015
@hazzik
Copy link
Member

hazzik commented Feb 22, 2015

@jlevitt can you please squash your code and rebase on top of master?

@jlevitt
Copy link
Contributor Author

jlevitt commented Feb 23, 2015

@hazzik Sure thing. I may not be able to get to it for a while though, as I will be travelling this week.

@hazzik
Copy link
Member

hazzik commented Apr 21, 2015

@jlevitt any chance to clean up the pull request?

@jlevitt
Copy link
Contributor Author

jlevitt commented Apr 22, 2015

@hazzik Yes. Sorry I forgot about this. I will set a reminder to work on it this weekend.

@hazzik
Copy link
Member

hazzik commented Apr 23, 2015

@jlevitt thanks!

@hazzik
Copy link
Member

hazzik commented May 6, 2015

Weekends has passed, any news? @jlevitt

@jlevitt
Copy link
Contributor Author

jlevitt commented May 11, 2015

@hazzik I'm sorry I've been too busy lately to get to this. I've been moving houses. I still have a reminder for myself to do it, but I need to find time.

@jlevitt
Copy link
Contributor Author

jlevitt commented May 12, 2015

@hazzik This branch has been squashed and rebased. Sorry for the delay.

.Add(Op)
.Add(parameters[i]);

if (columnNullness[i])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not check the code yet, but shouldn't it be opposite?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked. It seems correct.

@hazzik
Copy link
Member

hazzik commented May 13, 2015

@jlevitt thanks

hazzik added a commit that referenced this pull request May 13, 2015
NH-3634 - Fix comparing property with component with nullable properties in Criteria/QueryOver
@hazzik hazzik merged commit f5b97a8 into nhibernate:master May 13, 2015
@hazzik
Copy link
Member

hazzik commented May 13, 2015

Thanks a lot, @jlevitt

@hazzik hazzik changed the title Bug fix for NH-3634 NH-3634 - Fix comparing property to component with nullable properties in Criteria/QueryOver May 13, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants