3 ms·
> actually querying with an ORM is usually terrible What do you think of stuff like Hibernate Query Language? I'm currently working on a project that might use
by Terr_ 12y ago
> actually querying with an ORM is usually terrible
What do you think of stuff like Hibernate Query Language? I'm currently working on a project that might use DQL (a PHP variation) to get our snarl of tables under control.
- yessql 12y agoThe fact that Hibernate Query Language even exists tells you that ORM is a bad idea.
- threeseed 12y agoThat makes absolutely no sense. The whole point of ORM is that it is database agnostic. Given how different databases twist the SQL standard and provide a whole raft of proprietary extensions you need an abstracted query layer. Whether you give it a name like HQL or don't there will always be some layer.
- tokenrove 12y agoSure, but one can have an "ARM" (Abstract Relational Model) that abstracts away from database-specifics without trying to shoehorn the relational model into an object model, which isn't a one-to-one mapping. It doesn't have to be an ORM.
- akmiller 12y agoI hope that's not the whole point of an ORM given how pervasive they seem to be in every project and how few any given projects ever switch their backend out. Choosing an ORM because it abstracts you away from the storage engine seems like a terrible reason. I agree with Conery, choose the components that will compose your application wisely and then embrace those choices and use them to their fullest.
- derefr 12y agoCouldn't the abstracted query layer... be SQL? You don't need to speak it to the server; you can parse it at the client-library level and send whatever optimized thing the server likes to it.
- spacemanmatt 12y agoI think the basic underlying issue is some developers just don't want to understand data. The rest are cascade effects.
- joesmo 12y agoDQL and Doctrine are absolutely horrific. Not to mention extremely slow both in development time and especially in execution. I will bet money you will regret using them soon enough. I already am. In the apps I'm working on, the time spent in Doctrine is > 20x the time spent actually making the queries. EDIT: I inherited this system. I'd never use an ORM by choice.
- spacemanmatt 12y agoI think SQL is already a DSL for querying, and it is beyond clumsy trying to second-guess one (pretty good) DSL from a second (decidedly less mature, less standardized) DSL.
- abawany 12y agoThis is why I have come to love MyBatis. It lets me use SQL for the queries and then deserializes the results into a structure of my choice, even something as simple as List<Map<String, Object>> in Java.