gofabian / spring-boot-data-r2dbc-jooq

Reactive JOOQ - an R2DBC adapter for Spring Boot
MIT License
39 stars 11 forks source link

Added support for forced types #23

Closed robbydf closed 3 years ago

robbydf commented 4 years ago

Ignored Eclipse IDE files Specified the maven-javadoc-plugin to treat the sources as Java 8

nayrban commented 4 years ago

quick question, do you have to provide the forcedType even if you add the configuration into the jooq code gen plugin?

like:

 <forcedTypes>
    <forcedType>
        <name>BOOLEAN</name>
        <expression>.*\.ENABLED|.*\.USE_CLIENT_LOCATION</expression>
   </forcedType>
</forcedTypes>                                           
gofabian commented 3 years ago

The root cause is that JOOQ and r2dbc-postgresql have different data classes.

I am not sure about your solution. This will only work for a small subset of types as the underlying r2dbc codec must support them. For example you can force to convert org.jooq.JSONB to String but probably not to something else. That's why I do not think it is good to provide an interface to set arbitrary "forced types" when only one or two will work.

Furthermore your solution only works for reading data (SELECT) and not for writing data (INSERT, UPDATE).

A solution could be to introduce concrete adapters between types of JOOQ and R2DBC drivers. In the next release there will be a Converter class and default JSON/JSONB support. You can replace the default converter via dslContext.configuration().data("converter", yourConverter).

gofabian commented 3 years ago

Closed in favor of solution in release 0.3.0