Skip to content
Advertisement

JOOQ – inline Converter not being applied

In my build.gradle I use a converter in my forcedTypes. This works fine where i need it.

However, I am trying to convert a comma separated string into a list of enums for a specificuse case:

This throws an exception

This is the model I am fetching into:

Am I missing something?

UPDATE:

I am able to convert inline using

What is the difference between the initial converter I apply vs the late stage map conversion?

Advertisement

Answer

While it seems reasonable to expect that Field.as(Field) would use the argument field’s name and type for type coercion, this is not the case. As per the Javadoc:

Create an alias for this field based on another field’s name.

In order to coerce your expression to the desired data type, you have to do this, manually:

See Field.coerce(DataType)

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement