Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> Yeah, but when you add/change a new property to your most used class you don't have to change 500 odd SQL statements, it just works.

ORM doesn't have anything to do with SQL statements. ORM only operates on the results those SQL statements produce.

You're probably thinking of the active record pattern, which combines ORM with query building into an interesting monstrosity. Indeed, query builders produce SQL statements and can save you from changing 500 odd raw SQL queries.



A lot of ORMs create SQL statements too, they have an integrated query builder. And functionality for updating, deleting and even creating/modifying schemas (migrations).

But as always: use the right tool for the job. A hammer is a great tool, but not suitable for removing screws (most of the time).


> A lot of ORMs create SQL statements too, they have an integrated query builder.

These are technically active record libraries. One of the popular ones is literally known as ActiveRecord, but the whole suite of them are implementations of the active record pattern.

ORM is simply the process of converting relations (i.e. sets of tuples, i.e. rows and columns) into structured objects and back again. This layer of concern is independent of query generation.


What everyone's talking about here is what is commonly referred to as an ORM by everyone apart from you, apparently.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: