Search code examples
javaderbyjooq

jOOQ Converters and types


In my jOOQ configuration file I have defined a converter for DATE fields but I have some problems defining the conditions for the type on forcedType's section.

For testing I put on expression:

<expression>.*</expression>

and in types:

<types>DATE</types>

I was expecting to match all the columns which data type is DATE. Instead it doesn't match any of them other than one column where its type is DATE like other columns that it doesn't match but this one has as column def : CURRENT DATE, seems it matches this.

To make it works I have to use:

<types>.*DATE.*</types>

Can someone explain me this? I am using Derby as db.

Thanks for the help

Update with an example

I have these fields in various tables:

Table A:

INSERT_DATE DATE NOT NULL

Table B:

CREATION_DATE DATE NOT NULL

Table C:

RELEASE_DATE DATE DEFAULT CURRENT DATE

Using the forcedTypes with <expression>.*</expression> and <types>DATE</types>

only the field on table C after generating the code with jOOQ is using the converter. The ones in Table A,B are ignored. The only difference that I see is the "CURRENT DATE"


Solution

  • This seems to be a bug in jOOQ, which I have registered on GitHub, now:

    It looks as though the types that are fed into the <forcedType/> evaluation contain the NOT NULL clause from Derby's DDL. There is a related issue that asks for more logging information when applying these <forcedTypes/>:

    The workaround for you before this bug is fixed, is really to use regular expressions to stay on the safe side, similar to the one you've used, or better:

    <types>DATE.*</types>