Consider JDBCType in String-based repository queries#2193
Closed
parazit-IR wants to merge 1 commit intospring-projects:mainfrom
Closed
Consider JDBCType in String-based repository queries#2193parazit-IR wants to merge 1 commit intospring-projects:mainfrom
parazit-IR wants to merge 1 commit intospring-projects:mainfrom
Conversation
Signed-off-by: Mohammadali Jalalkamali <m.ali.jalalkamali@gmail.com>
1792bce to
569cd9c
Compare
Member
|
Thank you for your contribution. That's merged, polished, and backported now. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR addresses GH-2188 (Converters with JDBCType.OTHER broken).
Summary
Custom converters that return
JdbcValuewithJDBCType.OTHERstopped working correctly for string-based queries.StringBasedJdbcQuerytreatedJDBCType.OTHERas a special case and did not register its SQL type when binding parameters, so the JDBC driver did not seeTypes.OTHERanymore.Changes
StringBasedJdbcQuery.bindParameters(…)to register the SQL type for all non-nullSQLTypevalues, includingJDBCType.OTHER, and only fall back to the type-lessaddValue(name, value)overload when the JDBC type is actuallynull.StringBasedJdbcQueryUnitTeststhat:@WritingConverterreturningJdbcValue.of(…, JDBCType.OTHER),SqlParameterSourceexposesTypes.OTHERfor the bound parameter.This restores the behavior for PostgreSQL enum/custom types and other use cases that rely on
JDBCType.OTHERin custom converters.Closes #2188