spring-boot-data-r2dbc-jooq
spring-boot-data-r2dbc-jooq copied to clipboard
Wrong decode mechanism when using custom AbstractCodec based on field type
https://github.com/gofabian/spring-boot-data-r2dbc-jooq/blob/49e1ebe64b62e226be3b2b022f4906125f9c7851/src/main/java/gofabian/r2dbc/jooq/RowConverter.java#L25
since you always decode an object with the target Object.class type, io.r2dbc.postgresql.codec.AbstractCodec doesn't work anymore with extra registred codec based on this implementation since io.r2dbc.postgresql.codec.AbstractCodec#canDecode is based on field type and you always pass Object.class type.
Was working fine in 0.2.0 version of your lib. I don't know with you dont pass anymore the field type but Object.class when you row.get ?
Thanks for your report. Could you please provide a code sample that demonstrates the issue?
I don't know with you dont pass anymore the field type but Object.class when you row.get ?
I cannot remember. We had some issues in data conversion. But maybe this was an unnecessary change.
Well a bit difficult to reproduce it fast, but it's linked to the fact that when we create a new domain extension with jooq we only need to register a org.jooq.Converter. In reactive jooq, we need to register both a converter and a io.r2dbc.postgresql.extension.CodecRegistrar + AbstractCodec<NEWTYPE> implements Extension too otherwise when inserting a record we got an exception due to the fact that the codec is not existing for the NEWTYPE. In blocking jooq, codec is not necessary eg:
public final TableField<ReceiptInvoiceAddressRecord, Locale> COUNTRY = createField(DSL.name("country"), org.jooq.impl.SQLDataType.VARCHAR(10).nullable(false), this, "", new CountryConverter());
in blocking jooq CountryConverter is enough in reactive jooq (with your lib) i have to add this code: public final class LocaleCodec extends AbstractCodec<Locale> implements Extension { + public class LocaleCodecRegistrar implements CodecRegistrar { registering this new codec
and a META-INF/services io.r2dbc.postgresql.codec.LocaleCodecRegistrar
Seems that ReactiveJooq don't work OOTB with extras org.jooq.Converter
In fact, i got a workaround for my case, i registered my codec FIRST and since it was handling Object.class types (+ other types) , he was overriding behaviour for decoding basic string.
To solve my case, i just registered my codec in latest position