Ayende @ Rahien

It's a girl

What is going on with NHibernate 2.0?

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...

Comments

Sean Chambers
11/13/2007 03:24 AM by
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
11/13/2007 06:03 AM by
Ayende Rahien

Sean,

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

Sean Chambers
11/13/2007 12:30 PM by
Sean Chambers

I meant to say 0..1

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

Ayende Rahien
11/13/2007 12:37 PM by
Ayende Rahien

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

John Chapman
11/13/2007 12:40 PM by
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.

Thanks,

John Chapman

Ayende Rahien
11/13/2007 12:43 PM by
Ayende Rahien

John,

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
11/13/2007 01:50 PM by
Jonas K

When will the next version af NHibernate be released?

Fabio Maulo
11/13/2007 03:17 PM by
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.

Jo&#227;o Bragan&#231;a
11/13/2007 04:13 PM by
João Bragança

Does this mean that NHibernate 1.2.1 is going to be skipped?

Ayende Rahien
11/13/2007 05:53 PM by
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
11/13/2007 06:28 PM by
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
11/13/2007 06:31 PM by
Ayende Rahien

Colin,

Can you really give me a use case for this?

pete w
11/13/2007 07:30 PM by
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
11/13/2007 07:47 PM by
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
11/13/2007 08:03 PM by
Colin Jack

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

Ayende Rahien
11/13/2007 10:38 PM by
Ayende Rahien

Colin,

Those two classes there are not part of inheritance chain.

I'll put up a separate post about it

Mats Helander
11/16/2007 01:26 PM by
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..

/Mats

zahra karimi
11/16/2007 02:20 PM by
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
11/16/2007 02:26 PM by
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.

raffaeu
11/28/2007 08:10 AM by
raffaeu

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
11/28/2007 01:03 PM by
Ayende Rahien

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

Nels Olsen
12/07/2007 05:49 PM by
Nels Olsen

Fabio,

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 ...

Comments have been closed on this topic.