可用版本:Dev (3.21) | 最新 (3.20)

合成同义词

适用于 ❌ 开源版   ✅ Express 版   ✅ 专业版   ✅ 企业版

jOOQ 的代码生成器可以识别数据库声明并报告的同义词。但有些数据库不会报告所有同义词。在这种情况下,可以为表声明一个合成同义词

XML(独立和 Maven)
编程方式
Gradle (Kotlin)
Gradle (Groovy)
Gradle(第三方)
<configuration>
  <generator>
    <database>
      <syntheticObjects>
        <synonyms>
          <synonym>

            <!-- Optional catalog of the synonym (if omitted, this is the same as the table's). -->
            <catalog>CATALOG</catalog>

            <!-- Optional schema of the synonym (if omitted, this is the same as the table's). -->
            <schema>SCHEMA</schema>

            <!-- Mandatory name of the synonym. -->
            <name>SYNONYM</name>

            <!-- Mandatory regular expression matching a tables that have this synonym. -->
            <table>SCHEMA\.TABLE</table>
          </synonym>
        </synonyms>
      </syntheticObjects>
    </database>
  </generator>
</configuration>

有关更多详细信息,请参见配置 XSD独立代码生成maven 代码生成

new org.jooq.meta.jaxb.Configuration()
  .withGenerator(new Generator()
    .withDatabase(new Database()
      .withSyntheticObjects(new SyntheticObjectsType()
        .withSynonyms(
          new SyntheticSynonymType()

            // Optional catalog of the synonym (if omitted, this is the same as the table's).
            .withCatalog("CATALOG")

            // Optional schema of the synonym (if omitted, this is the same as the table's).
            .withSchema("SCHEMA")

            // Mandatory name of the synonym.
            .withName("SYNONYM")

            // Mandatory regular expression matching a tables that have this synonym.
            .withTable("SCHEMA\\.TABLE")
        )
      )
    )
  )

有关更多详细信息,请参见配置 XSD程序化代码生成

import org.jooq.meta.jaxb.*


configuration {
  generator {
    database {
      syntheticObjects {
        synonyms {
          synonym {

            // Optional catalog of the synonym (if omitted, this is the same as the table's).
            catalog = "CATALOG"

            // Optional schema of the synonym (if omitted, this is the same as the table's).
            schema = "SCHEMA"

            // Mandatory name of the synonym.
            name = "SYNONYM"

            // Mandatory regular expression matching a tables that have this synonym.
            table = "SCHEMA\\.TABLE"
          }
        }
      }
    }
  }
}

有关更多详细信息,请参见配置 XSDgradle 代码生成

configuration {
  generator {
    database {
      syntheticObjects {
        synonyms {
          synonym {

            // Optional catalog of the synonym (if omitted, this is the same as the table's).
            catalog = "CATALOG"

            // Optional schema of the synonym (if omitted, this is the same as the table's).
            schema = "SCHEMA"

            // Mandatory name of the synonym.
            name = "SYNONYM"

            // Mandatory regular expression matching a tables that have this synonym.
            table = "SCHEMA\\.TABLE"
          }
        }
      }
    }
  }
}

有关更多详细信息,请参见配置 XSDgradle 代码生成

// The jOOQ-codegen-gradle plugin has been introduced in version 3.19.
// Please use the official plugin instead of the third party plugin that was recommended before.

一如既往,当使用正则表达式时,它们是具有默认标志的正则表达式

引用此页

反馈

您对此页面有任何反馈吗? 我们很乐意听到它!

The jOOQ Logo