1

我正在尝试将 jOOQ 与具有 tsvectors 的 postgres 数据库一起使用。我将此添加到我的配置文件中:

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

我正在尝试将其应用于ts_message_text列:

[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

但我得到:

[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>
4

1 回答 1

1

应该有一个额外的日志消息进一步:

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

在您的特定情况下,这条消息似乎没有在 jOOQ 3.15.3 中打印出来,但是......似乎是一个日志记录错误。

于 2021-09-21T17:55:40.077 回答