Hi Kiru, Indeed, this has been asked before, but I cannot seem to find it either :-) It never hurts to have multiple discussions about the same thing as this will increase the chance of future visitors finding one of the discussions.
In principle, this can be achieved in two ways: 1. By moving classes manually after the code generation using some build post processor task. 2. By implementing a rather sophisticated programmatic generator strategy [1], which overrides the file location of the generated files 3. By including / excluding the (un)desired tables / objects from each relevant sub-project In cases 1) and 2), you will need to extract code generation from your various projects / sub-projects into an external project and generate the code into the relevant sub-project either before building each project, or you trigger code generation manually and check in the generated sources. Also, there will probably be some cyclic dependencies, which you have to clean up yourself. In case 3) you will lose all foreign key information between tables from different projects, which means you'll lose 1-2 features that would otherwise be available, including the new implicit join feature. However, there's another approach, which I highly recommend pursuing: 4. Create another sub-project that contains your entire schema and let all the other sub-projects depend on that. After all, if your schema is not already modular, it will be difficult to pretend it is through only the jOOQ code generator. I hope this helps, Lukas [1]: https://www.jooq.org/doc/latest/manual/code-generation/codegen-generatorstrategy On Wed, Sep 19, 2018 at 3:40 PM Kirusanth Poopalasingam < [email protected]> wrote: > Hello, > > I'm not sure if this has been already asked, but I couldn't find it ( > maybe my search terms are different ). > > I have the following setup, one *commons* project and several > sub-projects. > > Each sub-project has an own database and schema. Some entities ( like the > User ) are defined in the commons project. > > I use jOOQ for all the sub-projects. Each Subproject has its own Records, > Keys, Tables-class generated. > The problem I face is, that all sub-projects also generated all the > commonly defined tables ( like UserRecord ). > > Is it possible to share the Records classes with jOOQ such that I > generated them in *commons* once and reuse them in each sub-project. > > That way I can also write type-safe queries in the *commons* code ( as a > workaround I write queries like this: > dsl.selectFrom(DSL.table("user")).fetchOne(); > ) > > Thank you, > Kiru > > -- > 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. > -- 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.
