4 ms·
I wrote an early Java ORM (1996-2000) and I've come to the conclusion that ORMs are a bad idea. ORMs make the easy even easier, and the difficult impossible. Th
by geophile 13y ago
I wrote an early Java ORM (1996-2000) and I've come to the conclusion that ORMs are a bad idea. ORMs make the easy even easier, and the difficult impossible. The basic problem is that writing good, high-performing SQL is hard enough as it is. You have to understand indexes, clustering, execution plans, and query optimization to get good performance. Add an ORM to the picture and then you have to figure out how to say what you want in this brand new language, through a mapping layer.
I don't want to give up either objects or relational databases, (the choice that some other comments have suggested). What I am willing to give up is an ORM generating SQL. Writing SQL doesn't bother me. What bothers me is dealing with Java PreparedStatements, Connections, and ResultSets. This is all trivial boilerplate stuff, that an automated approach can do easily. I want to preserve my brain and fingers for the hard stuff, writing clean, fast Java and SQL.
I have heard that iBatis takes this approach, but I haven't tried it myself.
- einhverfr 13y ago> The basic problem is that writing good, high-performing SQL is hard enough as it is. You have to understand indexes, clustering, execution plans, and query optimization to get good performance. Not to mention cache specifics (something that has personally bitten me). To be honest, my preference is actually to write a service locator against stored procedures. This allows queries to be maintained separately from the application (and loosely coupled from them also). This is not too far from what iBatis does except that I would use stored procedures instead of mapped sql. What db's are you using? If Pg only, interested in porting the PGObject approach to Java?