eventuate-foundation / eventuate-common

Other
12 stars 20 forks source link

values do not correspond the keys in r2dbc selects #98

Open dartartem opened 3 years ago

dartartem commented 3 years ago

For example:

test_table
column_a  column_b  column_c
row1_value_a  row1_value_b  row1_value_c 

This code https://github.com/eventuate-foundation/eventuate-common/blob/d56dbe3ae08484661b56ceb7b76a199547a8fb72/eventuate-common-spring-reactive-jdbc/src/main/java/io/eventuate/common/spring/jdbc/reactive/EventuateSpringReactiveJdbcStatementExecutor.java#L40-L46

Can return the following map:

column_a -> row1_value_c 
column_b -> row1_value_a 
column_c -> row1_value_b 

Problem is in r2dbc library. Issue is fixed half of year ago but not yet released, it is expected in version 0.8.3 current version is 0.8.2

See:

https://github.com/spring-projects/spring-framework/issues/26124 https://github.com/mirromutth/r2dbc-mysql/issues/149 https://github.com/mirromutth/r2dbc-mysql/pull/159 https://github.com/mirromutth/r2dbc-mysql/milestone/7

I found a workaround, mapper returns correct values:

https://github.com/eventuate-foundation/eventuate-common/blob/d56dbe3ae08484661b56ceb7b76a199547a8fb72/eventuate-common-spring-reactive-jdbc/src/main/java/io/eventuate/common/spring/jdbc/reactive/EventuateSpringReactiveJdbcStatementExecutor.java#L48-L54