r/programming 7d ago

Solving the 1+N Query Problem

https://acadia.engineering/blog/solving-the-1-plus-N-query-problem
130 Upvotes

94 comments sorted by

View all comments

62

u/disposepriority 7d ago

There is a really easy way of avoiding this when you just don't use ORMs

7

u/Schmittfried 7d ago

Pretty sure you’ll write your own, worse ORM then. ORMs solve the very real problem of avoiding tons of tedious and error-prone mapping overhead. They will also let you fall back to SQL for anything that would be too complicated to do on the ORM level, so you get the best of both worlds. 

8

u/HappyAngrySquid 7d ago

There are plenty of query builders and scanner libraries that give you this without kneecapping you.

5

u/Schmittfried 7d ago

If they automatically map between your entity/DTO/DAO objects and your DB tables, they are ORMs in my book. What is an ORM if not a query builder with automated record mapping and maybe a structured/type-safe way to write queries?