Spring-framework: Spring r2dbc ColumnMapRowMapper wrong mapping when using MySQL driver

Created on 20 Nov 2020  路  6Comments  路  Source: spring-projects/spring-framework


Affects: 5.3.1


var collectList = r2dbcEntityTemplate.databaseClient.sql("""
            select * from pending_message
        """.trimIndent())
//                .map(EntityRowMapper(PendingMessage::class.java,r2dbcConverter))
                .fetch()
                .all()
                .collectList().block()

When I use DatabaseClient, the fetch method is mapped incorrectly.

For example:
the order of returned field values is: a -> a, b -> b, c -> c, d -> d,
But the final map obtained is: c -> a, a -> b, d -> c, b -> d.

external-project data

Most helpful comment

Yes, please. I created mirromutth/r2dbc-mysql#149.

All 6 comments

@mp911de, does this sound familiar to you?

Is this something we should investigate within the spring-r2dbc module in Spring Framework?

Thanks for the ping. We've seen a similar issue in Spring Data R2DBC (https://github.com/spring-projects/spring-data-r2dbc/issues/478) that was caused by the Postgres driver. It was fixed in the driver (https://github.com/pgjdbc/r2dbc-postgresql/issues/337) in version 0.8.6.RELEASE.

@wangxing-git which driver and version of the driver are you using?

The underlying cause is a difference in column metadata iteration order vs. the result column order.

Thanks for the ping. We've seen a similar issue in Spring Data R2DBC (spring-projects/spring-data-r2dbc#478) that was caused by the Postgres driver. It was fixed in the driver (pgjdbc/r2dbc-postgresql#337) in version 0.8.6.RELEASE.

@wangxing-git which driver and version of the driver are you using?

The underlying cause is a difference in column metadata iteration order vs. the result column order.

The mysql driver I use, the version is 8.0.22.
r2dbc-bom version is Arabba-SR8.

In that case, this problem should be fixed in the MySQL driver. Paging @mirromutth.

@mp911de, shall we close this issue in favor of an issue raised against r2dbc-mysql?

Yes, please. I created mirromutth/r2dbc-mysql#149.

Was this page helpful?
0 / 5 - 0 ratings