Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News Learn NHibernate with The Summer of NHibernate

Learn NHibernate with The Summer of NHibernate

This item in japanese


NHibernate has grown in popularity lately with more wide-spread use because of ALT.NET and competing technologies such as the Microsoft Entity Framework.  A new screen cast series called The Summer of NHibernate has been created to expose more developers to this technology. 

NHibernate is a port of the Java Hibernate Core to the Microsoft .NET Framework.  It is an Object-Relational Mapper (OR/M) whose purpose is persisting .NET objects to a relational database.  The term OR/M can give developers the impression of  complex configuration and steep learning curve. 

This does not need to be the case thanks to Steve Bohlen for creating The Summer of NHibernate screen cast series.  Steve describes the series as:

I am producing a series of successive screencast sessions that cover the complete use and implementation of NHibernate.  Called Summer of NHibernate, this series of screencasts is designed to take the newbie who knows nothing at all about NHibernate and teach them everything they need to know to start using NHibernate in a real-world application by the end of the hot summer months.  These screencasts will act as a set of reference materials that we can provide to new hires to help them get ramped up on the use of NHibernate in a short-order.

The series currently has a total of 6 sessions starting from the very basics of setting up and getting started with NHibernate to significant more detail.  Each screen cast runs about 90 minutes and detail of each new episode is posted along with the source code on the web site.

Example content of the first episode include:


  • Get the NHibernate dlls and .xsd files
  • Demonstrate how to add the xsd files to VS XML intellisense capabilities to get syntax support in the XML files
  • Use a simple Customer — Orders — OrderItems style database
  • Hand-code DTO class for the ‘Customer’ table
    • Introduce the concepts of 1:1 relation between table and class
    • (the dumb-DTO pattern; start here since it’s by far the simplest way to work)
  • Hand-code the Customer.hbm.xml mapping file to expose people to this syntax
  • Hand-code the hibernate.cfg.xml file to expose people to this syntax
  • Setup the project in VS (data access class lib)
  • Setup a corresponding test class to go along with it (to be used to exercise the data access class lib)
    • Further demonstrates the value of unit tests as a ‘harness’ for exercising concepts in a safe vacuum
  • Code a simple method that demonstrates the basic mechanics of interacting with NHibernate to retrieve all Customers from the database
    • ISessionFactory, ISession, reading configuration(s)
    • Leveraging the using ( ) {…} block to ensure session is properly closes/disposed of when done

 More information about the series can be found on The Summer of NHibernate web site and details of each episode can be found on Steven's blog.

Rate this Article


Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p