NHibernate - enthusiasts wanted.
I just did a search and noone has posted anything about NHibernate on this forum, so I thought I'd get the ball rolling.
What is it?
NHibernate is a .NET port of an open source technology known as Hibernate .
Hibernate is a forward-thinking development environment, tailored to the Java Programming environment, intended to marry Object-Oriented Objects to Relational Database Objects. This is known as Object-Relational Mapping (ORM). It is also sometimes refered to as a Persistence Framework.
Why do I care?
The purpose of ORM, in my opinion, is to reap the high-performance persistence benefits from the RDBMS, while developing in Object-Oriented languages (and ignoring the RDBMS persistence details).
I make the analogy of today's RDBMS to yesterday's disk subsystems. Once you had to know the hardware-level details of a disk-driven storage device in order to persist and retreive files to/from it. You had to know the head/sector/block information. You had to make low-level device calls in assembler. On mainframes, you had to know the begin and end sector of data partitions. Even as things advanced into C, you had to open and close file handles and keep track of them.
You get the idea. Today you just tell some File Object to .Open a file and .Write to it. I'll grant you it's not as fast during run-time, but during design-time this can be a huge benefit to the lifecycle of a project. It also frees our minds from the shackles of tedium and allows our creativity to flourish as we endeavor to solve problems using computer technologies.
In a similar way, the vast majority of us have learned the ins-and-outs of RDBMS subsystems. We can all write intelligent SQL statements, and design our table structures and Normalize them appropriately. We may have mastered the semantics, but we cannot escape the tedium it imposes on every aspect of an Object-Oriented Development project.
Why use it?
Object Oriented Design was intended to closely map computer languages to our natural ways of thinking (esp. creatively). Some may argue this has not been accomplished, and OOD is not for everyone. However, if you favor OOD then ORM is a natural extension. As OOD is a "next step" forward from procedural based development, so ORM is a "next step" forward from RDBMS details (CRUD).
To choose ORM (NHibernate in the context of .NET) is specifically to let go of the old ADO/DOA paradigm. ADO is the pervasion of RDBMS details into the nooks and crannies of your development efforts.
ORM implies that it is explicitly inappropriate to have SQL statements, Recordsets, Fields and MoveNext(s) in your code! ORM is intended to free your mind from the low-level details from RDBMS and make room for better Object Oriented Development, Patterns, and best practices.
Where is it?
I am not a Java guy, so Hibernate has been mostly inaccessible until recently. The .NET version is NHibernate. I am interested in pursuing the useage of NHibernate for myself, and can find no books on the topic!
Why am I here?
I am just sort of jumping on the Hibernate bandwagon now, so I am no expert on the topic, which brings me to the purpose of this posting. I am looking for interest on the topic on these forums. I realize there are many other products which implement ORM and Persistence Frameworks, but I am interested in NHibernate specifically.
What do I want?
I'm just looking for those who can post useful links to articles, books, and tutorials on NHibernate.
This is an article written on the marriage of ADO.NET to NHibernate and I am starting there for a tutorial.
This is another tutorial of sorts that I will be looking at.
This is a decent intro to ORM.
Re: NHibernate - enthusiasts wanted.
Hi,
I'm developing a sort of CRM app. I've been reading a lot about nHibernate, Did you come up with some good examples lately ?
greetings.
Re: NHibernate - enthusiasts wanted.
just started an nHibernate project as well. any of you guys have any working sample?:)
Re: NHibernate - enthusiasts wanted.
Hi,
I noticed this blog, which offers a lot of useful info.
BTW - The first link in the OP's thread is not working.
Re: NHibernate - enthusiasts wanted.
Hey,
I must thank abhijit for bumping this very old thread, because this seems like something I have been looking for! I quickly read a few articles about nHibernate and it looks very promising!
I find myself developing quite a large number of small applications using an Access database, often for just the one customer. I am slowly starting to hate the amount of work I have to do just to get my database connections up and running! I usually create a class for every table (that represents one record in that table), along with a 'Manager' object that manages saving and loading of those classes, and while that is all pretty straightforward, the code is very reptitive. It is almost exactly the same in all cases, except with different table names and different properties.
I got so tired of it that I wrote my own 'framework' to deal with this. It can manage loading and saving of simple datamodels (really only loading records from a single table, and I recently built in loading data from multiple tables with an inner join query via foreign keys), but that's all I need 99% of the time. It works pretty well, and it cuts down on the amount of code I have to write by maybe 80% at a guess. The only downside is that it uses Reflection extensively so it is very slooooow... A quick comparison I did today showed me that with my method a simple select query took 1200 ms, while the same query using the 'manual' approach I usually take took only 50 ms. A major difference which I think makes my framework pretty useless, except in case the databases are small.
nHibernate looks like it's pretty similar to my simple framework, and I am just hoping it does not have the same downfall. Can anyone tell me whether I will see a serious performance hit (50 ms vs 1200 ms is pretty serious if you ask me) or is it equally fast or at least negligibly less fast then the manual approach?
I'm definitely going to read up on this, can anyone recommend any books perhaps? I don't usually read books to learn programming as I do that enough in school, but I think a good book in this case can teach me much more quickly then if I just went out and tried some stuff...
Thanks!
Re: NHibernate - enthusiasts wanted.
Nick,
I am starting off with NHibernate and the blog link I posted has some basic examples to help you get started. Do you care to share your framework?
Re: NHibernate - enthusiasts wanted.
Sure I can share it, I'm in the process of commenting it now. I was actually going to post it up here in the hopes that someone could look it over and spot where I could maybe cut down on the Reflection a bit to speed it up. I'm afraid that without at least a basic guide the code will be mostly gibberish :p