r/java • • Mar 13 '26

jOOQ Deep Dive: CTE, MULTISET, and SQL Pipelines

https://www.youtube.com/watch?v=J47iBW3TTUc
41 Upvotes

22 comments sorted by

View all comments

Show parent comment

1

u/lukaseder Mar 14 '26

My point was: good luck to anyone attempting to do it manually ;)

1

u/pohart Mar 14 '26 edited Mar 14 '26

I added it to my internal orm. It wasn't bad. Certainly it's nicer with jooq, though. And it makes a huge difference for avoiding N+1s without duplicating tons of data, so once your start using it you start using it all over the place.

2

u/lukaseder Mar 14 '26

What's the reason for having your own ORM?

1

u/pohart Mar 14 '26

There weren't really good open source options in 1998. Frankly until jooq came along and I never felt like there was any alternative better than what we had, and at this point it's not worth switching.

1

u/lukaseder Mar 15 '26

I see, it's that old. Can it do anything that jOOQ should be able to do as well?

1

u/pohart Mar 15 '26

Nothing I know of.

1

u/SleeperAwakened Mar 14 '26

Thought so because in the end it IS just a query.

jOOQ makes it easier, true. But even jOOQ runs into limitations at some point which plain JDBC has not, like recursive queries (building trees) for example.

3

u/asm0dey Mar 14 '26

Wait, which limitations? jOOQ supports recursive CTEs!

2

u/lukaseder Mar 14 '26

What are you talking about.

jOOQ supports recursive CTE and CONNECT BY. Even if it didn't, you can always fall back to native SQL in jOOQ. Besides, there are utilities like these: https://blog.jooq.org/how-to-turn-a-list-of-flat-elements-into-a-hierarchy-in-java-sql-or-jooq

And jOOQ's MULTISET is as much about SQL generation as it is about mapping. Both of which are very complex problems, which you really don't want to maintain, yourself with JDBC directly.