是否可以在不生成代码的情况下使用JOOQ? [英] Can JOOQ be used without code generation?

查看:85
本文介绍了是否可以在不生成代码的情况下使用JOOQ?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在评估JOOQ是否可以在仍在开发中的新系统中使用.我想避免在与应用程序一起开发数据库时生成代码,而只是为该应用程序充当持久性存储的角色.因此,预计数据库模式定义将由Java代码(java中的表定义)驱动.

I am assessing JOOQ for use in a new system that is still under development. I would like to avoid code generation when the database is being developed along with the application and simply plays a role of a persistent storage for this application. So, the database schema definition is expected to be driven by Java code (table definitions in java).

JOOQ是否适合上述用例?是否有用于模式定义的Java DSL?

Is JOOQ appropriate for the above use case? Is there a java DSL for schema definition?

推荐答案

JOOQ是否适合上述用例?

Is JOOQ appropriate for the above use case?

是的,许多jOOQ用户仅使用运行时库,而没有代码生成器.可以在

Yes, many jOOQ users use only the runtime library without the code generator. Examples can be seen in the getting started guide.

是否有用于模式定义的Java DSL?

Is there a java DSL for schema definition?

jOOQ包装JDBC的 DatabaseMetaData org.jooq.Meta 中,您可以通过 DSLContext.meta() .从Meta返回的对象还是jOOQ的SchemaTableField对象,您可以将其与API的其余部分一起使用.

jOOQ wraps JDBC's DatabaseMetaData in org.jooq.Meta, which you can access via DSLContext.meta(). The objects returned from Meta are again jOOQ's Schema, Table, Field objects, which you can use with the rest of the API.

在旁注中,弗拉德·米哈尔恰(Vlad Mihalcea)写了一篇非常有趣的博客文章,内容涉及如何在Hibernate项目中使用jOOQ代码生成器,在该项目中,数据库由JPA注释的Java模型驱动.也许这对您也有用.

On a side note, Vlad Mihalcea has written this very interseting blog post about how to use the jOOQ code generator in a Hibernate project, where the database is driven by the JPA-annotated Java model. Maybe that is useful to you as well.

这篇关于是否可以在不生成代码的情况下使用JOOQ?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆