Object Relational Mapping: You are doing it wrong when...

time to read 2 min | 283 words

  • You concatenate strings to build dynamic queries.
  • You have no consistent way of querying the database.
  • You need to create bad relational model to satisfy the object model that you want.
  • You have a hard time mapping between the database and the objects, and you are not a beginner.
  • You goes against well defined concepts such as layering, seperation of concerns, etc.
  • You need to implement functionality that is already part of the OR/M
  • You need to do a lot of extra work in order to make the OR/M work correctly.

If any of the above is true for you, STOP! Take a deep breath, and go take a look at the manual. There is a better way.

I believe that I can make OR/M works for 95% of the possible schemas that are out there. And that is a bold statement since I sometimes work with schemas defined for main frames. I also believe that if it is hard to do, it is hard to do because of valid reasons. A good OR/M will steer you in the direction of good database design, when you fight it, it means that there is a problem.