Can I use JOOQ without generating code?

I am evaluating JOOQ for use in a new system that is still under development. I would like to avoid code generation when the database is developed together with the application and just acts as a permanent storage for this application. Thus, it is expected that the definition of the database schema will be determined by Java code (table definitions in java).

Does the JOOQ match the above use case? Is there a DSL for schema definition?

+6
source share
1 answer

Does the JOOQ match the above use case?

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

Is there a DSL for schema definition?

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

Using a code generator with a Java managed database schema

On the other hand, Vlad Mikhalcha wrote this very internet message about how to use the jOOQ code generator in the Hibernate project, where the database is based on a JPA-annotated Java model . Perhaps this is also useful for you.

+2
source

Source: https://habr.com/ru/post/978558/


All Articles