Object Relational Mappers (ORMs) are a terrible idea

ORMs (like Hibernate in Java) are a flawed solution to an imagined problem that should be consigned to the wastebasket of history.

They are predicated on the idea that relational databases are old fashioned and should be avoided at all costs, but if you can’t avoid them, use some kind of convoluted wrapper that tries (and generally fails) to pretend that the relational database is something it isn’t – an object oriented datastore.

Often what people are really looking for when they use an ORM is some kind of database abstraction layer.  It is reasonable to abstract the database somehow, but I recommend not using an abstraction layer that seeks to pretend the database is something that it isn’t.

In Java, the best such database abstraction layer I’ve found is Jooq, I highly recommend it.

One thought on “Object Relational Mappers (ORMs) are a terrible idea

  1. Michael Nash

    Ian, I couldn’t agree more.

    Having spent a lot of time trying to untangle many different projects from Hibernate and the like over the year, ORM has started to mean “place where all the problems start” in my mind.

    Lately I’ve been doing a mix of either NoSQL (Mongo, Cassanda, Couch, etc), or using Slick in Scala. Slick appears to be a lot like Jooq, that you describe in your post.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *