News for hackers. Stuff that matters.
Re:What ORMs have taught me: just learn SQL (2014) by scarface74 on Monday December 18, 2017 @05:54AM (#15950794)
So the easiest way to avoid using an ORM is to create your own ORM?

What AI do you need? You map your tables to objects and relationships between objects via FK relationships.

Re:What ORMs have taught me: just learn SQL (2014) by pjmlp on Monday December 18, 2017 @06:24AM (#15950898)
I can get very creative with SELECTs, making use of Prolog style queries, which are fully done server side on the database.

Most ORMs will download all the data and evaluate them on the client side, with code that is even more convoluted that the SQL one and thus with less performance.

Re:What ORMs have taught me: just learn SQL (2014) by scarface74 on Monday December 18, 2017 @06:52AM (#15951023)
If your ORM is downloading all of your data and querying client side, then your ORM "is doing it wrong".

Entity Framework and any other Linq to data provider translates the Linq expression to the native language of the source data and does it server side.

Re:What ORMs have taught me: just learn SQL (2014) by pjmlp on Monday December 18, 2017 @07:15AM (#15951111)
I know EF, which is why my comment also mentions "code that is even more convoluted that the SQL one and thus with less performance".

LINQ only allows for a fraction of what is possible with SQL, and good luck having the best queries generated out of it, if the RDMS doesn't happen to be SQL Server.

Re:What ORMs have taught me: just learn SQL (2014) by scarface74 on Monday December 18, 2017 @07:49AM (#15951253)
Actually my DMS is sometimes Mongo and the Mongo driver does pretty well at translating Linq to Mongo Query using the aggregation framework.

It all depends on the talent of the authors of the drivers.

Re:What ORMs have taught me: just learn SQL (2014) by zzzeek on Monday December 18, 2017 @04:12PM (#15955559)
> Most ORMs will download all the data and evaluate them on the client side

I've seen that pattern in lots of homegrown applications, but I've never seen such a thing in a mainstream ORM. Care to provide examples ?

Re:What ORMs have taught me: just learn SQL (2014) by pjmlp on Tuesday December 19, 2017 @02:56AM (#15958518)
I've seen it a lot in entity beans and the early days of hibernate.

Nowadays I only bother with Dapper, MyBatis, using a mix of SQL and stored procedures.

EF only if the RDMS happens to be SQL Server.

Re:What ORMs have taught me: just learn SQL (2014) by sergiosgc on Monday December 18, 2017 @11:04AM (#15952554)
> What AI do you need? You map your tables to objects and relationships between objects via FK relationships.

That is only true in a one-to-many entity relationship (and even so, it is debatable). A one-to-one relationship can be modeled in the two objects, in one of them, or delegated to a third entity. A many-to-many entity relationship can also be handled, in OO, in various different ways. Idem for a ternary relationship or, basically any higher order relation between objects.

This is known, borrowing a term from electrical engineering, as an impedance mismatch between the two models, and it's not an easy problem by any measure.