Home > Software design >  Jooq forced type not being applied to column
Jooq forced type not being applied to column

Time:09-23

I'm trying to use jOOQ with a postgres db featuring tsvectors. I added this to my configuration file :

<forcedTypes>
    <forcedType>
        <userType>example.textsearch.TsVector</userType>
        <includeTypes>.*tsvector.*</includeTypes>
    </forcedType>
</forcedTypes>

I'm trying to apply it to the ts_message_text column :

[DEBUG] Fetched result           :  --------------- ---------------- ----------------- ------------------------ ----------------- ------------- ----------- ----------- -------------- ---------- -------- ----------- 
[DEBUG]                          : |column_name    |ordinal_position|data_type        |character_maximum_length|numeric_precision|numeric_scale|is_identity|is_nullable|column_default|udt_schema|udt_name|description|
[DEBUG]                          :  --------------- ---------------- ----------------- ------------------------ ----------------- ------------- ----------- ----------- -------------- ---------- -------- ----------- 
[DEBUG]                          : |sender_id      |               1|character varying|                      16|           {null}|       {null}|{null}     |YES        |{null}        |pg_catalog|varchar |{null}     |
[DEBUG]                          : |ts_message_text|               2|tsvector         |                  {null}|           {null}|       {null}|{null}     |YES        |{null}        |pg_catalog|tsvector|{null}     |
[DEBUG]                          :  --------------- ---------------- ----------------- ------------------------ ----------------- ------------- ----------- ----------- -------------- ---------- -------- ----------- 
...
INFO] Generating table         : ConversationsTexts.java [input=conversations_texts, output=conversations_texts, pk=N/A]
[DEBUG] With column              : name=sender_id, matching type names=[character varying, character varying(16), character varying(0), character varying(0,0), character varying(0, 0), varchar, pg_catalog.varchar]
[DEBUG] With column              : name=ts_message_text, matching type names=[tsvector, tsvector(0), tsvector(0,0), tsvector(0, 0), pg_catalog.tsvector]
[DEBUG] Type mapping             : conversations_texts.sender_id with type character varying
[DEBUG] Type mapping             : conversations_texts.ts_message_text with type tsvector
[INFO] Generating record        : ConversationsTextsRecord.java
[DEBUG] Type mapping             : conversations_texts.sender_id with type character varying
[DEBUG] Type mapping             : conversations_texts.ts_message_text with type tsvector

But I get :

[WARNING] Unused forced types      : There are unused forced types, which have not been used by this generation run.
This can be because of misconfigurations, such as, for example:
- case sensitive regular expressions
- regular expressions depending on whitespace (Pattern.COMMENTS is turned on!)
- missing or inadequate object qualification
- the object to which the configuration was applied in the past has been dropped
Try turning on DEBUG logging (-X in Maven, and <logging/> in jOOQ) to get additional info about the schema
[WARNING] Unused forced type       : <priority>0</priority><userType>example.textsearch.TsVector</userType><includeTypes>.*tsvector.*</includeTypes><nullability>ALL</nullability><objectType>ALL</objectType>

CodePudding user response:

There should be an additional log message further up:

[WARNING] Bad configuration for <forcedType/>. Either <binding/> or <converter/> 
  or <enumConverter/> or <lambdaConverter/> is required

It seems this message isn't getting printed in jOOQ 3.15.3 in your particular case, though... Seems to be a logging bug.

  • Related