Skip to content

JDBCType no longer considered by StringBasedJdbcQuery #2187

@flx5

Description

@flx5

Custom converters like these are broken in version 4:

new Converter<E, JdbcValue>() {
            @Override
            public JdbcValue convert(E source) {
                return JdbcValue.of(source.name(), JDBCType.OTHER);
            }
        };

The reason seems to be that previously the code 1111 was passed on whereas now it is dropped:

https://github.com/spring-projects/spring-data-relational/blame/f6d4b28912bdd149d7667251172cfcf6a46d04c8/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/repository/query/StringBasedJdbcQuery.java#L264

This breaks custom enum conversion for postgres again.


My current workaround is to create a custom SQLType like this:


    SQLType PG_ENUM_TYPE = new SQLType() {
        @Override
        public String getName() {
            return JDBCType.OTHER.getName();
        }

        @Override
        public String getVendor() {
            return JDBCType.OTHER.getVendor();
        }

        @Override
        public Integer getVendorTypeNumber() {
            return JDBCType.OTHER.getVendorTypeNumber();
        }
    };

By using the custom type the comparison fails and the 1111 code gets passed along to the database driver again.

Metadata

Metadata

Assignees

Labels

type: regressionA regression from a previous release

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions