3 ms·
> In fact, ORMs have been a massive headache because I can think in SQL but not in whatever the creator of the ORM was thinking in. Yes, fully agree on ORMs. T
by zvrba 6y ago
> In fact, ORMs have been a massive headache because I can think in SQL but not in whatever the creator of the ORM was thinking in.
Yes, fully agree on ORMs. They DO have one nice feature though: simple CRUD operations are way less verbose than constructing SQL statements.
What we lack is a better integration between the host language and the databse. Constructing a prepared statement from a string, setting parameters, executing, fetching rows from the result set and mapping back to fields... all is a major, repetitive PITA.
And yes, I find it easy to think in SQL and often wonder WTH an ORM is going to generate. Just recently I improved performance of an application by going from ORM to SQL; first I reduced number of round-trips (ORM/efcore first wants you to fetch an entity before you can update it), second, I batched updates into a single session/transaction. Win! :) [Oh, and don't get me started ranting about ORM and transactions.]
- fogetti 6y agoJust to let you know, those things are not needed at all if you use a different type of ORM, similar to ActiveRecord or Django ORM. It all depends on what you choose. So probably the first mistake was that you didn't do the homework of exploring ORMs maybe?