Hacker News new | ask | show | jobs
by KronisLV 590 days ago
> Imho raw sql is always best, build your own query generator which you understand its logic fully and is tailored for your project.

This comes with the caveat that someone will have to work with bespoke-sql-codegen:0.0.1 when you go work in another company, with StackOverflow being of no help, as well as an unknown amount of vulnerabilities.

I once worked on a Java project that put like 90% of the logic in the DB and the application mostly called prepared statements and parsed the results with a bunch of low level logic. There was some dynamic SQL generation but the end result was the whole thing feeling like code archaeology because of course there was basically no documentation or good examples on how to do things, decoupled from the already complex codebase.

It was blazing fast but also an absolute nightmare to work with. I would be similarly guarded towards using anything bespoke without a community and knowledge base, regardless of the stack.

As for ORMs, there’s nothing preventing you from making an efficient DB view and mapping that into an entity.