Hi Jonathan, jOOQ doesn't generate JPA entities. It can generate some JPA annotations to achieve some extent of interoperability, and to avoid re-inventing yet another set of our own annotations for annotation based mapping, but it was never the goal to generate actual entities.
I hope this helps, Lukas On Thu, Oct 28, 2021 at 7:19 PM Jonathan Burns < [email protected]> wrote: > I'm writing a simple 3-tier app using Spring Data: > https://github.com/jbburns/qcalendar > > My idea was to have the following workflow: > - Data model is defined using liquibase -> this takes care of all DDL > concerns > - Use this data model to generate Java code -> Jooq Codegen does this > - Integrate that generated code with Spring Data -> this will > automagically create my REST API > > Not that it matters here, but a further extension to this is: > - SpringDoc is used to generate an OpenAPI spec > - Gradle plugins are used to generate api for the front end > > Basically the idea here is that the middle-tier is so simple that it can > be mostly accomplished with codegen and Spring. > > I currently have this entire workflow working in the aforementioned repo. > > > However, because the JPA Entities generated by Jooq do not include the > relationship between each other, the results from the REST endpoint simply > contain an ID (foreign key) to another entity as opposed to the Entity > itself. That would be resolved if there was a way to get Jooq to generate > JPA > > My questions are: > - I'm not married to JPA... it was just the easiest way to do this. Is > anyone aware of a more direct integration between Jooq and Spring Data? > - Is there a way to get Jooq CodeGen to generate the JPA relationships? > For example, Jooq currently generates the following code: > > > > > > *public class Ao implements Serializable { private static final long > serialVersionUID = 1L; private Integer id; private Integer regionId;* > > However, I would like it to generate: > > > > > *public class Ao implements Serializable {private static final > long serialVersionUID = 1L;private Integer id;* > *@ManyToOne* > *@JoinColumn(name="**region_id* > *", nullable=false, updatable=false)private Region region;* > > > > TIA > > -- > 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]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/jooq-user/b87c1e2d-d078-4c70-8891-06cc2017e80en%40googlegroups.com > <https://groups.google.com/d/msgid/jooq-user/b87c1e2d-d078-4c70-8891-06cc2017e80en%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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jooq-user/CAB4ELO6ntSRyXxz80qJbL%3DwoJhf0NEU%2BV%2B3aRk951KHv_-L8NA%40mail.gmail.com.
