NHibernate has the 1.2.0 GA version, also it’s preparing to the 2.0 version that will have many ports from Hibernate 3.2.5 GA for Java.

At this time many changes were made to the NHibernate Core, big re-structurations to get into the new features.

Some features of 2.0 version:

StatelessSession: IStatelessSession it’s the interface that allow us to use sessions without first-level cache. Specially created for do bulks Saves/Updates/Deletes. IStateless has a similar semantic to ISession. Now, ISessionFactory it’s responsible of the factory of ISession as well too, IStatelessSession.

EventListeners: that feature allow us to intercept actions that NHibernate has taken before or after to achieve it. With the current version of NHibernate we only can make interceptions using the interfaces ILifecycle and IInterceptors. Now we can "talk" with NHibernate at a low level, before the Save has achieved it, or after as well.

EntityName: that feature allow us to use the classes with a unique name. We could use 1 class with 2 differents entity names (impossible so far). Something that will disapear at NHibernate are the types specifications in queries like typeof(<Type’s name>), only the Entity Name and Generics methods will stay. For example:

  • Session.Get<Foo>(id);
  • Session.Get("TheFooEntity",id);

Both are equivalents queries, the 2nd it’s a method that returns a System.Object and using the Entity Name feature. A preview of this you can see at trunk in IStatelessSession, that has the methods structured at this maner. As you can see, this will cause a breaking change at ISession structure.

DetachedQuery: this the DetachedCriteria’s brother but to HQL, this feature allow us to create queries detached of a Session, that help to play at our DAO implementation. It was a miss feature at NHibernate, to many things you can not do with Criteria. This implementation was available to many times ago at uNHAddIns, you can see here and here.

Stadistics: with this feature we will can do stadistics of our queries primarily. An example of this, that I’m shure you gonna love it, it’s maner that you can calculate the hit-ratio cache.

All between Transactions: it’s another breaking change to get the same behavior that Hibernate. When we will do a CRUD operation, we must put it between transactions. At the current version is not need it.