Skip to content
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

Got number of type instead null #92

Closed
RomaIvanovOfficial opened this issue Jan 28, 2023 · 1 comment
Closed

Got number of type instead null #92

RomaIvanovOfficial opened this issue Jan 28, 2023 · 1 comment

Comments

@RomaIvanovOfficial
Copy link

RomaIvanovOfficial commented Jan 28, 2023

Hello!
I use JdbcTemplate in spring boot. Try to execute update request with null parameter, e.g.
update customer set name = null, isValid = null
And I got name = 12, isValid = -7 in my log. And in method beforeQuery(execInfo: ExecutionInfo, queryInfoList: List<QueryInfo>) in queryInfoList I see the same numbers of type.

I want to get log name = null, isValid = null

@ttddyy
Copy link
Member

ttddyy commented Jan 30, 2023

When setNull is called, there is a SetNullParameterValueConverter that handles formatting the null value.
For example, setNull(index,Types.VARCHAR) is converted to NULL(VARCHAR).
This is the default implementation.

When setXyz(index, null) is called, the following logic converts to the display value as null.

protected String getParameterValueToDisplay(ParameterSetOperation param) {
String value;
if (ParameterSetOperation.isSetNullParameterOperation(param)) {
// for setNull
value = getDisplayValueForSetNull(param);
} else if (ParameterSetOperation.isRegisterOutParameterOperation(param)) {
// for registerOutParameter
value = getDisplayValueForRegisterOutParameter(param);
} else {
value = getDisplayValue(param);
}
return value;
}

You may have a custom converter, log entry creator, etc that simply shows an argument value.
In case it is not the case and the issue still persists, please provide a minimal sample project that reproduces the issue.

@ttddyy ttddyy closed this as not planned Won't fix, can't repro, duplicate, stale Jan 30, 2023
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

No branches or pull requests

2 participants