Skip to content

Comments

Consider JDBCType in String-based repository queries#2193

Closed
parazit-IR wants to merge 1 commit intospring-projects:mainfrom
parazit-IR:GH-2188-jdbc-type-other
Closed

Consider JDBCType in String-based repository queries#2193
parazit-IR wants to merge 1 commit intospring-projects:mainfrom
parazit-IR:GH-2188-jdbc-type-other

Conversation

@parazit-IR
Copy link
Contributor

This PR addresses GH-2188 (Converters with JDBCType.OTHER broken).

Summary

Custom converters that return JdbcValue with JDBCType.OTHER stopped working correctly for string-based queries.
StringBasedJdbcQuery treated JDBCType.OTHER as a special case and did not register its SQL type when binding parameters, so the JDBC driver did not see Types.OTHER anymore.

Changes

  • Update StringBasedJdbcQuery.bindParameters(…) to register the SQL type for all non-null SQLType values, including JDBCType.OTHER, and only fall back to the type-less addValue(name, value) overload when the JDBC type is actually null.
  • Add a regression test to StringBasedJdbcQueryUnitTests that:
    • uses a custom @WritingConverter returning JdbcValue.of(…, JDBCType.OTHER),
    • executes a string-based query method,
    • and asserts that the resulting SqlParameterSource exposes Types.OTHER for the bound parameter.

This restores the behavior for PostgreSQL enum/custom types and other use cases that rely on JDBCType.OTHER in custom converters.

Closes #2188

Signed-off-by: Mohammadali Jalalkamali <m.ali.jalalkamali@gmail.com>
@parazit-IR parazit-IR force-pushed the GH-2188-jdbc-type-other branch from 1792bce to 569cd9c Compare December 6, 2025 12:18
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Dec 6, 2025
@mp911de mp911de changed the title GH-2188 - Preserve JDBCType.OTHER for custom converters in string-based queries Preserve JDBCType.OTHER for custom converters in string-based queries Feb 23, 2026
@mp911de mp911de linked an issue Feb 23, 2026 that may be closed by this pull request
@mp911de mp911de added type: regression A regression from a previous release and removed status: waiting-for-triage An issue we've not yet triaged labels Feb 24, 2026
@mp911de mp911de changed the title Preserve JDBCType.OTHER for custom converters in string-based queries Consider JDBCType in String-based repository queries Feb 24, 2026
mp911de pushed a commit that referenced this pull request Feb 24, 2026
Signed-off-by: Mohammadali Jalalkamali <m.ali.jalalkamali@gmail.com>
Closes #2188
Original pull request: #2193
mp911de added a commit that referenced this pull request Feb 24, 2026
Introduce API for easier SQLType creation. Add test for query derivation.

See #2188
Original pull request: #2193
mp911de pushed a commit that referenced this pull request Feb 24, 2026
Signed-off-by: Mohammadali Jalalkamali <m.ali.jalalkamali@gmail.com>
Closes #2188
Original pull request: #2193
mp911de added a commit that referenced this pull request Feb 24, 2026
Introduce API for easier SQLType creation. Add test for query derivation.

See #2188
Original pull request: #2193
@mp911de
Copy link
Member

mp911de commented Feb 24, 2026

Thank you for your contribution. That's merged, polished, and backported now.

@mp911de mp911de closed this Feb 24, 2026
@mp911de mp911de added this to the 4.0.4 (2025.1.4) milestone Feb 24, 2026
mp911de pushed a commit that referenced this pull request Feb 24, 2026
Signed-off-by: Mohammadali Jalalkamali <m.ali.jalalkamali@gmail.com>
Closes #2187
Original pull request: #2193
mp911de added a commit that referenced this pull request Feb 24, 2026
Introduce API for easier SQLType creation. Add test for query derivation.

See #2187
Original pull request: #2193
mp911de pushed a commit that referenced this pull request Feb 24, 2026
Signed-off-by: Mohammadali Jalalkamali <m.ali.jalalkamali@gmail.com>
Closes #2187
Original pull request: #2193
mp911de added a commit that referenced this pull request Feb 24, 2026
Introduce API for easier SQLType creation. Add test for query derivation.

See #2187
Original pull request: #2193
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: regression A regression from a previous release

Projects

None yet

3 participants