Hi Lucas, Currently, I am using database-schema.xml file and jooq-codegen-maven plugin to generate jooq tables at build time. But Now I want to create jooq tables at runtime. So I was going through some articles where we can generate jooq tables at runtime using groovy or kotlin script. Is this a correct way or any other alternative. // Create a Groovy script that generates jOOQ classes def script = """ import org.jooq.codegen.GenerationTool import org.jooq.meta.jaxb.* import org.jooq.meta.extensions.* import org.jooq.meta.* import java.io.* def config = new Configuration() config.withJdbc(new Jdbc() .withDriver("c om.mysql.cj.jdbc.Driver") .withUrl("jdbc:mysql://localhost:3306/mydatabase") .withUser("myuser") .withPassword("mypassword")) config.withGenerator(new Generator() .withDatabase(new Database() .withName( "org.jooq.meta.mysql.MySQLDatabase") .withIncludes(".*") .withExcludes("") .withInputSchema("public")) .withGenerate(new Generate() .withPojos(true) .withDaos(true)) .withTarget(new Target() .withPackageName( "com.example.generated") .withDirectory("/path/to/generated/classes"))) def tool = new GenerationTool() tool.run(config, new PrintWriter(System.out)) """ // Evaluate the Groovy script to generate jOOQ classes GroovyShell shell = new GroovyShell(); shell.evaluate(script); // Use the generated jOOQ classes in your application DSLContext context = DSL.using(dataSource, SQLDialect.MYSQL); MyTableRecord record = context.selectFrom(MY_TABLE).where(MY_TABLE.ID.eq(1)).fetchOne();
On Thursday, October 12, 2023 at 12:11:32 PM UTC+5:30 lukas...@gmail.com wrote: > Hi Deepankar, > > Thank you for your message. > > What are you trying to do? > > Best Regards, > Lukas > > On Thu, Oct 12, 2023 at 8:02 AM deepankar gupta <deepankar...@gmail.com> > wrote: > >> can jooq create classes from database-schema file at runtime?? >> >> -- >> You received this message because you are subscribed to the Google Groups >> "jOOQ User Group" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to jooq-user+...@googlegroups.com. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/jooq-user/8419fe0a-469f-4be7-8124-167584db1f05n%40googlegroups.com >> >> <https://groups.google.com/d/msgid/jooq-user/8419fe0a-469f-4be7-8124-167584db1f05n%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- You received this message because you are subscribed to the Google Groups "jOOQ User Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to jooq-user+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jooq-user/ba7a1f97-7e3e-4337-98ec-007ab0166aecn%40googlegroups.com.