Do all the things like ++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatarSign Up
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple APILearn More
There should be an easy way to update multiple records at once, such as `Order.where(“close_at < ?”, end_of_period).update_all(closed: true)`. Bulk processing!
SuspiciousBug706185dBulk operations should be fast. And all options must be correct; i.e. covered by tests. The "easy"-part is subjective and depends on the language.
For example NHibernate (C#) is pretty straight forward: https://nhibernate.info/doc/...
You can then add integration tests and have an excellent compromise between performance (plain SQL under the hood), correctness and readability (operation written in the main programming language of the project).
Now we have two ways to modify data: the entity (good) and some random bulk-update (bad). We can unite both with the specification pattern, but that only increases complexity.
So, as long as you don't have SQL-like statements in your ORM operations, you should be fine.
lbfalvy10029180d@Root The object part of ORM provides state guarantees not expressed in the database structure. Data which is accessed through an object and data which is accessed directly from the database should be isolated. Rails' way of allowing the user to bulk edit and destroy objects while silently skipping validation without even the guardrail of different classes for checked and unchecked operations is about as useful and safe as C's generics with void*
Root79661180d@lbfalvy There are safe and unsafe versions of those: #delete calls validations and hooks, #destroy does not. There are also safe and unsafe ways to update records (though I’m less familiar with them; it’s #update_column, I believe?). Use the one you need at the time (and unsafe versions are typically only used for cleaning data.)
er1n15I was working on a very database heavy PHP app about six months ago. All database access was done directly, wi...
irene11First month of project we suggest that we test that Entity Framework has made reasonable DB queries because th...
rhymiz27BuT wHy Do YoU uSe An ORM? YoU sHoUlD wRiTe RaW SQL fOr P e R f O r M a N c E