-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
HHH-19085 NPE when using null value in CriteriaUpdate #11046
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
base: main
Are you sure you want to change the base?
Conversation
if ( value == null ) { | ||
return new ValueBindJpaCriteriaParameter<>( null, value, this ); | ||
} | ||
final var bindableType = resolveInferredParameterType( value, typeInferenceSource, getTypeConfiguration() ); | ||
if ( bindableType == null || isInstance( bindableType, value) ) { |
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.
Wouldn't it be better to try retaining the type inference source?
if ( value == null ) { | |
return new ValueBindJpaCriteriaParameter<>( null, value, this ); | |
} | |
final var bindableType = resolveInferredParameterType( value, typeInferenceSource, getTypeConfiguration() ); | |
if ( bindableType == null || isInstance( bindableType, value) ) { | |
final var bindableType = resolveInferredParameterType( value, typeInferenceSource, getTypeConfiguration() ); | |
if ( bindableType == null || value == null || isInstance( bindableType, value ) ) { |
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.
see
Line 155 in e0f889d
if ( value != null || criteriaParameter.getNodeType() == null ) { |
if we set the type than later on the value is not binded.
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.
not sure why we are not binding the null value when criteriaParameter.getNodeType()
is not null
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.
It looks like this was added as part of d9446e7, but I doubt that this is still useful. I'd suggest removing the if and always bind the value.
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.
AbstractSqmSelectionQuery
should probably be using this instead: if ( criteriaParameter instanceof ValueBindJpaCriteriaParameter<?> ) {
https://hibernate.atlassian.net/browse/HHH-19085
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license
and can be relicensed under the terms of the LGPL v2.1 license in the future at the maintainers' discretion.
For more information on licensing, please check here.