12 March 2007
NHibernate Tutorial, Jumptree Forum Part II - Spring.NET, Setup NHibernate Support
Part I - Why I choose NHibernate and what will I implement?
Part 3 - Nhibernate Forum - Part 3, Getting Ready
Part 4 - Setup and Add Category
Part 5 - Different Ways of Mapping File Configuration
I mentioned in my previous post that I going to implement our simple forum using NHibernate. Coming from the Java world, I know if we use Spring and Hibernate together, it would greatly simplify the work we have to do. Before I start my NHibernate implementation, the first step is to setup Spring.NET Integration.
I ventured into the Spring’s counterpart – Sprint.Net and I’m glad that there is currently support for NHibernate as well. It seems to be stable enough (supports sessionFactory, openSessionInView, declarative transaction manager and etc)
First, I tried to download the Spring Module – Spring.Data.Nhibernate12 (for NHibernate 1.2 Beta)
http://www.springframework.net/downloads/Spring.Data.NHibernate12/
Make sure you download the last link. I downloaded “Spring.Data.NHibernate12-20070306-1435.zip”
Well, the problem is after I downloaded the source, by opening up “/src/Spring/Spring.Data.NHibernate12/Spring.Data.NHibernate12.2005.csproj”, I see a lot of files are missing. (Only “Generics” folder is valid)
By opening up the .csproj file in notepad, I see it’s trying to referencing an outside project which really confused me. Took a quick look in the forum,
http://forum.springframework.net/showthread.php?t=921
the user “await” mentioned “So I figured out my problem. The distribution expects you to unzip both the 1.0 and 1.2 versions into a directory called Spring.Data.NHibernate .”.
Okay, still a bit confusing. So I downloaded Spring.Data.NHibernate 1.0 version here
http://www.springframework.net/downloads/Spring.Data.NHibernate/, again make sure you download the last link (which is the latest build). I downloaded “Spring.Data.NHibernate-20070228-1741.zip”
After play around with the setting, you have to setup your structure this way
Your Directory
/Spring.Data.NHibernate (unzip 1.0 files here - note, the name HAS to be "Spring.Data.NHibernate")
/Spring.Data.NHibernate 1.2 ( unzip your 1.2 files there, the name dosen't have to be the same)


Now go into your “Spring.Data.NHibernate1.2/src/Spring/Spring.Data.NHibernate12” directory, you’ll see the Spring.Data.NHiberante.2005.sln, open it up and you should be able to compile everything just fine.
Now go to "Spring.Data.NHibernate1.2/examples/spring/Spring.Northwind" directory and open up the Spring.Northwind.sln. This is an example for the Northwind implementation.

Take a look at the Spring.NorthWind.* packages. These projects includes configuration examples integrating NHibernate and Spring.NET
In my forum project later on, I'll be using them throughout the project. Stay tuned.