Skip to main content

Me and NHibernate

"If you hand roll your SQL statements you're stealing from your clients."

That is the essence of what Ayende is saying and I dearly wants to suppose he's right. I love the idea of a layer of abstraction over the database, bridging the relational world to the object oriented. But every time I've tried to setup NHibernate I've failed with even the most basic scenarios, and it pains me greatly knowing what's right but not getting it to work. I think the main issues are the following.

  • I'm a beginner looking for a silver bullet, but everytime I rip someones implementation and try to adapt it to my own situation I fail because every scenario seems to need its own custom solution.

  • Every time I search google for a solution to my problems, I only find articles with lingo I don't understand or so advanced that it's useless for my simple task. (NHibernate in F# anyone?)

  • When you read a discussion between the leading ORM specialists in the field they never ever agree on anything. Generic repositories, entities as domain model or how to handle the session factory. For every strong idea there seems to be an equally strong opposition.

  • It's not intuitive. Today I got a very cryptic exception that turned out to be that I forgot to add an Id-property to my entity. I guess that the exception message was refering to the abstract faulty state that was going on, but a google search turned out the most common failure. The whole framework seems to suffer from the same problem of expressing itself in what is correct and not what's easy to understand.

I will get there. After hours and hours of fighting with errors I will at last feel proficient enough to use it in an application for a client. Until then I'll worry about how every Joe Developer will manage to do the same thing and start traversing that learning curve.

comments powered by Disqus