I've used nHibernate for a few projects now, but I certainly don't consider myself an expert user. I'm skeptical that nHibernate is a better solution that using stored procedures [holding up my shield to deflect flaming arrows].
I'm sure there's a reason why so many people use nHibernate, so I guess I'm looking for you tell me about the positives about nHibernate that I'm not aware of. Here are some of my beefs:
1. When I ask most people what benefits you get out of nHibernate, they usually tell me that the mapping files save you the work of having to maintain CRUD procs and the loading/saving/deleting of your object using those procs. But I can use code generation and generate those procs just as fast as I can create a mapping file. So to me, the time-saving benefit of nHibernate is gone in this case.
2. We've spent a ton of time on our project trying to figure out how to do something in the mapping file. I'm sure that once I become an expert at mapping files it'll go a lot faster. But to me, it seems that I'm just learning another way to do what I already knew how to do in SQL.
3. Because people aren't experts at creating mapping files, they tend to make mistakes in their mapping files without knowing it. Usually this involves loading or saving of more than what you want to load or save. So your object will load and save correctly, but it might do a lot of other extra work that you don't know about. So you have to look at all of the output to see what exactly is going on to make sure that everything is working the way you want it to.
4. Sometimes I want to do stuff immediately after an object is loaded or saved. But because there are so many different ways to save or load an object (e.g. the object by itself, a parent object that contains the object, or a list the contains the object), it's difficult to know when those events happen. If I'm using stored procs, I know when everything is happening because I'm calling a constructor or I'm calling object.Save(). Yes, I might have to write a little more code to populate the objects from the database, but this is code that I can generate using a code generator.
Again, nHibernate obviously has value because so many of you use it, and I don't want to be one of these people who writes something off just because I don't understand it or it's not familiar with it. So please tell me if and why you think I'm wrong.
_________________ Jon Kruger
http://jonkruger.com/blog
|