Ayende @ Rahien

My name is Oren Eini
Founder of Hibernating Rhinos LTD and RavenDB.
You can reach me by phone or email:


+972 52-548-6969

, @ Q c

Posts: 6,026 | Comments: 44,842

filter by tags archive

What is going on with NHibernate 2.0?

time to read 3 min | 464 words

Well, I haven't wrote anything about that in a while, and I am scanning the change log right now, and it looks like a lot have been going on.

Fabio Maulo has been going at it with gusto, and has ported several very big features, and I would like to take this opportunity to thank him for that. Karl Chu has been doing some really nice things as well, and deserve thanks as well. Awesome work, both of you.

Me, I am sitting in the corner with slack jaw and watching the feature pile on top of each other.

This is a partial list only, mind you, I am going over the log, but it contains over three hundred commits, and I am not that patient. I also put things here that I consider significant, which may means that I am missing some things that are important to others.

New & Exciting features:

  • CriteriaTransformer - allows to clone and transform ICriteria and DetachedCriteria.
  • Criteria inspection - improved the ability to see what it going on there, previously was write only.
  • Multi Criteria - the companion to Multi Query
  • <join> tables - allowing to compose a single entity from several tables.
  • Events, Actions and Listeners - this is a very big feature, and it extends the way you can work with NHibernate in very deep ways. Think of it like the interceptor++.
  • Persistence Context - this is important for the internal NHibernate structure, it makes it much close to the Hibernate one, which in turn make it easier to share features.
  • list-index - adding the ability to specify the base index of a list, instead of always going from 0
  • property-ref - allow to have an association that is not based on the primary key on an entity
  • Stateless Session - easier way to work with bulk data, without needing the first level cache
  • Cache Mode - better control on how the session will work with the second level cache.
  • Statistics feature - useful for tests, and to see exactly what NHibernate is doing.
  • Query plan - NHibernate will parse named queries in advance, which allows to do nice things, like provide tool support for them, beyond the perf implications
  • Update IInterceptor - now supports H3.2 methods and capabilities
  • <union-subclass> - like <join-subclass>, but with union instead of joins

Other changes:

  • Bug fixes
  • Using more .Net 2.0 features, generic collections throughout, etc.
  • CLS Compliant refactoring
  • Changing the internal processing of the XML processing to use a more easy to use serialized classes
  • Single consistent configuration schema, for both app.config and hibernate.cfg.xml
  • Updated NHibernate's proxies to use Castle's RC3

Again, this is partial list only, and I am covering the last 4 months only, but I am very pleased with what we have even so far...


Sean Chambers

"Criteria inspection - improved the ability to see what it going on there, previously was write only."

this in itself will be extremely useful. I have run into a couple of occasions where I wanted to tinker with criteria objects.

It's not listed in your post, but is there anything in there about more options for one-to-one mappings? I don't like how its currently setup with using a PK to PK for joins. Alot of times I have run into scenarios where a one-to-one is not required, i.e. 0..* I guess thats where property-ref comes in.

The generics thoughout is nice as well to have everything on the same page. I wish I had more time to contribute to nhibernate but I find it a little bit of an intimidating project myself. =P

Ayende Rahien


If you want one to one that has 0...* properoties, that is the one to many, no?

Sean Chambers

I meant to say 0..1

that is, the one-to-one would be not be required in certain situations

Ayende Rahien

many to one, then no, with the ability to be null.

John Chapman

Help me if I'm wrong, but I believe property-ref is an existing feature. Heck, I've used it in applications before. Has there been enhancements to the property-ref feature? Previously it worked on many-to-one, one-to-one and one-to-many, does it now support other relationships such as inheritance?

I assume you posted this here as a 2.0 enhancement for a reason. I'm curious to know how it has been enhanced.


John Chapman

Ayende Rahien


I believe that this refers to the ability to use this on and , although it is entirely possible that I am mistaken, of course.

Jonas K

When will the next version af NHibernate be released?

Fabio Maulo

And some others:

  • DetachedQuery

  • EntityMode (POCO + MAP)

  • Possibility to have another ProxyFactory (nother than the optimum CastleDynamicProxy)

  • Entity-Name

  • ExecuteNativeUpdate (to execute SQL without a ResultSet)

  • I hope propertyLaziness

  • some other cascade (merge-refresh)

I hope all H3.2.5 except.................. well you know AST parser.

Ayende Rahien

No, it doesn't.

There are separate branches for that. Bug fixes goes to 1.2.1, features to 2.0

Colin Jack

tables is something we've been using and is very cool, more support for generics is also going to be very useful...can we map classes with generic arguments yet though?

Ayende Rahien


Can you really give me a use case for this?

pete w

I find that one of the factes of Linq to entities is the constant NofityPropertyChanged events that are generated within every property setter. They have string parameters for the property names, which is a weak binding and it bugs me.

I am interested if NHibernate 2 handles change prorogations/ntofications in a more graceful manner

Fabio Maulo

You can use a Custom IProxyFactory. An example is available on trunk (by Ayende) in the test CustomProxy.

By default NH don't know, and don't care on your implementation of an entity so you can implement what you want/need.

Colin Jack

Thanks for responding, the example in http://jira.nhibernate.org/browse/NH-960 is probably representative.

Ayende Rahien


Those two classes there are not part of inheritance chain.

I'll put up a separate post about it

Mats Helander

"- Possibility to have another ProxyFactory (nother than the optimum CastleDynamicProxy)"

This is something I really applaud! Not to imply that there would be anything wrong with Castle's stuff - it's great, of course - but I think this particular plug point will be required in any proxying framework that wants to play nice with /other/ frameworks that also want to proxy around and thus is extremely important. Probably not too many run into this problem yet, but that day should come..


zahra karimi

hello ,i am work wit hibernate in few time,for run of first Example when compiler come to

configuration .Addassembly("Assemblyname");

raise this Error


nHibernateClass.User.hbm.xml(2,2): XML validation error: The 'urn:nhibernate-mapping-2.2:nhibernate-mapping' element is not declared. ""

and if the Property of BuildAction =content this Error ispass and in line of

session.Save("instance of Entity Class");

rais Error :Unknown Entity

Please Help me Again;

Ayende Rahien

This is not the place to ask general NHibernate questions.

I have told you already, such questions should go to the forums.

Any further comments of this sort will be removed.


I see in Hibernate version, for Java, there is a tool for eclipse able to map with GUI ... Is there will be something like that in new NHibernate future.

Ayende Rahien

There are several, Active Writer is the one I like.

Nels Olsen


Our company is hoping to use sufficient cash incentive wherever appropriate to get the AST parser into NHibernate one way or another within about 6 months ...

Comment preview

Comments have been closed on this topic.


No future posts left, oh my!


  1. Technical observations from my wife (3):
    13 Nov 2015 - Production issues
  2. Production postmortem (13):
    13 Nov 2015 - The case of the “it is slow on that machine (only)”
  3. Speaking (5):
    09 Nov 2015 - Community talk in Kiev, Ukraine–What does it take to be a good developer
  4. Find the bug (5):
    11 Sep 2015 - The concurrent memory buster
  5. Buffer allocation strategies (3):
    09 Sep 2015 - Bad usage patterns
View all series


Main feed Feed Stats
Comments feed   Comments Feed Stats