Hacker News new | past | comments | ask | show | jobs | submit login

That is a cheap comment. Could you elaborate why you disagree with the comment you respond to?



> 1. inability to represent arbitrary query results.... You can either use any SQL or HQL with hibernate.

> 2. lazy loading of attributes - certainly configurable, but if you rely on SELECT statements being generated while you are navigating a 'persistent' object, you will run into unexpected performance issues.... Some ORMS can detect and actually solve n+1 query problems. And, as with SQL, you can just specify what you want to eager or lazy load. If you don't like that, you can always use SQL with your ORM.

> 3. Troubleshooting is a pain. Especially if you rely on dynamically building queries. No it's not.. Hibernate can check your queries for syntactical problems, which helps testing. The query-builder is just that... a query builder. If you really need to optimize certain things and need some vendor-specific SQL comments to give query hints, you can fall back to using SQL, and STILL use all the benefits of the ORM.

> 4. Doesn't treat data as data. First of all data coming from SQL queries is stale the moment it arrives in your objects.... The whole point is that it maps your relational model or objects. But if you don't like that, you can still use the framework to retrieve dataframes / rows. It's not foolish to think about an object model.

> 5. No/limited control over writes/updates.... Again, you can use the ORM to update, and either skip or use model validations. You can run update queries, and if you really want, you can just use SQL.

Your whole post scream someone who's comfortable with SQL (good thing, I am too, most developers are not), but who has played with some ORM for like 2 hours, and got frustrated with the functionality and didn't take the time to actually read up on the docs.

The other type of person with this stance is a front-end developer on some huge site, which needs to squeeze all the performance out of the CPU, where the requests are mostly read-only, and don't really do anything else.. For example showing some posts on your Facebook homepage. The *only* downside of an ORM in that case is some cpu and allocation overhead of mapping your data to objects. In that case, use rust instead of php ;)


Not the original responder - hibernate has had projections to solve #1 for ages, the rest are on point IMO.




Join us for AI Startup School this June 16-17 in San Francisco!

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

Search: