jOOQ / jOOQ

jOOQ is the best way to write SQL in Java
https://www.jooq.org
Other
6.09k stars 1.2k forks source link

Mapping annotations @OneToOne, @OneToMany, @ManyToMany support in Generated POJOS. #16980

Closed gem-sunder closed 1 month ago

gem-sunder commented 1 month ago

Your question

We are using jOOQ code Generator to generate spring boot project using database queries. In Generated Pojos we wanted @OneToOne, @OneToMany, @ManyToMany mapping if two table depends upon each other. Currently we can't see this feature and not sure if jOOQ provide these mapping.

Also, if the feature is not available yet, is jOOQ planning to add this in upcoming updates?

jOOQ Version

3.19

Database product and version

mysql.version=8.0.26 or above

Java Version

17 or above

JDBC / R2DBC driver name and version (include name if unofficial driver)

com.mysql.cj.jdbc.Driver

SightStudio commented 1 month ago

Why do you need that? jOOQ is not ORM.

But I hope there's something that makes it easier to group queries in a nested 1:N relationship (without multiset)

lukaseder commented 1 month ago

Thanks for your message, @gem-sunder.

There's no need for jOOQ to copy other API's ideas of how to map things. See these sections of the manual to help understand what jOOQ's take on mapping nested records or collections is:

Rather than expecting jOOQ to do the exact thing other APIs are doing, think about why jOOQ chose a more SQL-idiomatic path to mapping and embrace it. I'm positive that you'll like this approach more.

@SightStudio But I hope there's something that makes it easier to group queries in a nested 1:N relationship (without multiset)

I don't know what you mean by this.

SightStudio commented 1 month ago

@lukaseder never mind.

My question was perfectly the same as this. this (make it easy for mapping example in link)

and I got my answer from this (use JPA and jOOQ both)

Sorry for my lack of searching skills. :)