[caption id="attachment_296" align="alignleft" width="300" caption="Scale"]875413_47541979[/caption]

In a late blog post Stephan Schmidt vents his problems with hibernate and declares "ORMs are a thing of the past"

I agree to some extend:
- The SQL generated by Hibernate by default is horrible. Huge joins, with hundreds of columns, many unneeded.
- Annotations feel like dirt in your code, and maintaining XML mappings is just painful.
- LazyInitializationExceptions are a pain in the a.. neck.

But does that justify the conclusion, that ORMs will go away in the near future? I don't think so. Of course my perspective is biased, but in the applications I build I deal typically with 200-500 tables. Just typing the basic CRUD Statement, and wrapping them into usable objects is a pain, and a lot of work, which I gladly will hand over to an ORM.

Tracking changes in objects is another task, I gladly handover to an ORM.

Even writing annotations, while being far from perfect is better then most alternatives I know.

Implementing my own caching logic? No thanx. The ORM can do that pretty well.

I think the crucial point lies in Stephans last paragraph, where he sketches some ideas for alternatives. ORMs aren't bad in themselves. They are just difficult to get right. Hibernate did a great job. It is the first one to get wide spread usage. And most points mentioned above are a weakness in Hibernate (or JPA) or possibly Java. So my claim is: ORMs aren't dead, they aren't even grown up.

So what properties might a grown up ORM have?

But as so often, the most important change will be a people change: People will finally let databases drop into the background where they belong, and manage the schema through the ORM. I always wonder "Why?" when I hear people describe how the build a database first, and then map classes to the tables. That is the wrong way around: Build a strong domain model first. Let the ORM create a database schema for you from that. And then get someone with strong database knowledge involved to tweak it where necessary. This is when you start seriously gaining something for your struggle with the ORM. Most importantly: you get strong support for database refactorings.

If you want to read more about the whole ORM discussion, you might be interested in this article by Debasish Ghosh.