Hi Branko, Thanks for your message and thanks for your nice words. I'll comment inline.
2016-12-18 17:20 GMT+01:00 Branko Gvoka <[email protected]>: > Hi there, > > I started with JOOQ 2-3 days ago, by first watching a video from GeeCON > '14 by Lukas, where at the end he explained that JOOQ is meant for systems > that are schema first where model is already defined. I totally liked the > possibility that JOOQ gives you when it comes to querying your data. > > I soon realized that there is some work related to generating the stubs > from annotated classes, tho it is meant to be done only once when > application should start to use JOOQ. > No, why? This is mostly a continuous process. You modify the schema, you regenerate the code. People do that all the time. If you really want to work with annotated classes (i.e. JPA entities), you can still do that by using jOOQ's JPADatabase: https://www.jooq.org/doc/latest/manual/code-generation/codegen-jpa/ It'll use Hibernate to create an in-memory H2 database from the annotated entities, and then run the jOOQ code generator on that. Obviously, by following this approach, you'll be missing out on a lot of vendor-specific storage features, etc. as this approach will make your schema depend on the limited JPA features. > I didn't find a way of regenerating the classes again later when the model > has changed, since the generate goes after the compilation phase > You can generate code in any phase, preferably in the code generation phase... > and maven couldn't let me regenerate everything before I cleanup "missing" > stubs. In QueryDSL, they embedded the generating in process phase I believe > and they way of doing the generation is probably overcoming this problem > because of that, since it is a part of process phase, where you dont have > problem of running the compilation phase without these stubs. > > My questions would be, is there a support like this already created? Did > the approach change after '14? > No, it's always been the same :) > I am asking this since I would like to embed JOOQ in a code generator that > I am developing with my friends, which gives you opportunity to generate > code out of specification you create (similar tool to JHipster). Since the > tool that we are building gives you opportunity to change the model all the > time, if there isnt any support, I would generate stubs with tool, that > would follow the model as well. > Do note that you don't need to use the Maven plugin to generate code with jOOQ. You can run jOOQ's code generator programmatically inside of any other sort of application, including inside of your own code generator: https://www.jooq.org/doc/latest/manual/code-generation/codegen-programmatic In fact, the jOOQ Maven plugin does nothing else. It's a program that starts the code generator (GenerationTool) programmatically. Hope this helps Let me know if you have any additional questions and I'm very happy to help Cheers, Lukas -- 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
