哪个代码生成器应用于SQL Server

发布于 2025-01-19 19:49:39 字数 590 浏览 1 评论 0原文

我将我的liqibase脚本用于JOOQ代码生成。正如我从说明和日志中学到的那样,方言为H2。

如果应用程序随后针对SQL Server数据库运行,这是问题吗?是否必须调整代码生成,还是元素保持不变?

<plugins>
         <plugin>
            <groupId>org.jooq</groupId>
            <artifactId>jooq-codegen-maven</artifactId>
            ...
            <configuration>
               <generator>
                  <name>org.jooq.codegen.JavaGenerator</name>
                  <database>
                     <name>org.jooq.meta.extensions.liquibase.LiquibaseDatabase</name>

I use my liqibase scripts for Jooq code generation. As I learned from the instructions and log, the Dialect is H2.

Is that a problem if the application runs against a SQL Server database afterwards? Does the code generation have to be adjusted or do the metaclasses remain the same?

<plugins>
         <plugin>
            <groupId>org.jooq</groupId>
            <artifactId>jooq-codegen-maven</artifactId>
            ...
            <configuration>
               <generator>
                  <name>org.jooq.codegen.JavaGenerator</name>
                  <database>
                     <name>org.jooq.meta.extensions.liquibase.LiquibaseDatabase</name>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

遇到 2025-01-26 19:49:39

LiquibaseDatabase可用于简单的数据库模式,其中不希望连接到实际的数据库实例(例如出于性能原因)以生成代码。它的缺点是它不是一个实际的 SQL Server 数据库,而是一个模拟迁移 - 目前位于内存 H2 数据库上。这意味着某些供应商特定的功能可能无法按预期工作。

对于具有供应商特定功能(例如存储过程等)的更复杂模式,通常最好不要使用上述实用程序。相反,请使用连接到实际数据库实例的 SQLServerDatabase

您仍然可以在基于 testcontainers 的 SQL Server 实例上使用 Liquibase 进行设置在生成 jOOQ 代码之前您的架构,如本博客文章中所述

The LiquibaseDatabase can be used for simple database schemas where it is desirable not to connect to an actual database instance (e.g. for performance reasons) in order to generate code. It's drawbacks are that it's not an actual SQL Server database, but a simulated migration - currently on an in-memory H2 database. This means that some vendor specific functionality may not work as expected.

It is usually better not to use the above utility for more complex schemas with vendor specific features (e.g. stored procedures, etc.). Instead, use the SQLServerDatabase that connects to an actual database instance.

You could still use Liquibase on a testcontainers based SQL Server instance to set up your schema prior to generating jOOQ code, as explained in this blog post here.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文