0

Is there any way to generate SQLite database model from Java code using JOOQ?

1 Answer 1

1

You can generate DDL statements like CREATE TABLE .. or ALTER TABLE .. ADD CONSTRAINT .. using the DSLContext.ddl() API, for instance:

// SCHEMA is the generated schema that contains a reference to all generated tables
Queries ddl =
DSL.using(configuration)
   .ddl(SCHEMA);

for (Query query : ddl.queries()) {
    System.out.println(query);
}

This is documented here: https://www.jooq.org/doc/latest/manual/sql-building/ddl-statements/generating-ddl/

Sign up to request clarification or add additional context in comments.

2 Comments

Can you give some example what is SCHEMA? Are these Java classes similar to JPA Entities?
@PeterPenzov: It's a generated schema reference. But hey, perhaps I misunderstood your question. Would you mind being explicit about what you'd like to do?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.