我希望 jOOQ 自動代碼生成器基于位于資源檔案夾中的 liquibase 模式 xml 檔案運行(而不是基于資料庫連接)。pom.xml 中的配置部分如下所示:
<configuration xmlns="http://www.jooq.org/xsd/jooq-codegen-3.13.4.xsd">
<generator>
<database>
<name>org.jooq.meta.extensions.liquibase.LiquibaseDatabase</name>
<includes>.*</includes>
<excludes></excludes>
<inputSchema>public</inputSchema>
<properties>
<property>
<key>scripts</key>
<value>/liquibase-outputChangeLog.xml</value>
</property>
<property>
<key>includeLiquibaseTables</key>
<value>true</value>
</property>
<property>
<key>database.liquibaseSchemaName</key>
<value>public</value>
</property>
</properties>
</database>
<target>
<packageName>jooqGenerated</packageName>
<directory>target/generated-sources/jooq</directory>
</target>
</generator>
</configuration>
它無法在指定的檔案夾中生成 jOOQ 代碼,說
[ERROR] azure/postgresql/TrackerAzureImpl.java: package ...tables does not exist (for all the tables, I cannot even see elsewhere where jooq code is getting generated),
Also one warning: No schemata were loaded: [WARNING] No schemata were loaded : Please check your connection settings, and whether your database (and your database version!) is really supported by jOOQ. Also, check the case-sensitivity in your configured <inputSchema/> elements : {=[public]}
請指導。
uj5u.com熱心網友回復:
這很可能是由于一個錯誤:https ://github.com/jOOQ/jOOQ/issues/12997
解釋和解決方法
在幕后,在 jOOQ 3.16 中LiquibaseDatabase,DDLDatabase、 和JPADatabase都使用記憶體中的 H2 資料庫模擬您的資料庫遷移。將來可能會改變,但現在就是這樣。在 H2 中,默認情況下,所有識別符號都是大寫的,<inputSchema/>配置也是如此。這意味著您應該包括PUBLIC架構,而不是public架構。
請注意,代碼生成輸出也將包含對 的參考PUBLIC,而不是public,因此,如果您想繼續使用 ,則必須在運行時使用設定LiquibaseDatabase關閉識別符號的參考。RenderQuotedNames
更強大的替代方案,不會在 H2 上模擬 Liquibase
或者,您不必使用LiquibaseDatabase,正如我在其他地方提到的那樣。您還可以使用 testcontainers 直接在 PostgreSQL 上運行實際遷移,并對實際的 PostgreSQL 資料庫進行反向工程,如本博文中所述。
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/446964.html
標籤:爪哇 行家 液基 乔克 jooq-codegen-maven
