Friday, December 1, 2006

NHibernate 1.2 : not-found = ignore (many-to-one)

This is another excellent feature of NHibernate 1.2 that helps a lot to get legacy databases (90% of the world..? ;) ) working smoothly..

Why? Because in previous version orphaned records where always treated as an exception instead of having a more "soft" handling (Example: treat the object reference null).

If you are working with composite keys this scenario was even worse : valid null values (which should not be really be considered orphans) also raised an exception when 1 of it;s components is not null...

So, inside the Templates what we are doing is set that new XML property to "true" WHEN the relation is based on a composite key (please remmember you can always change the calculated value to whatever you like!).

NOTE: The only important thing to notice is that this will do an extra separate query (don't ask ME why, have no clue why that's needed.. )

3 comments:

James Carter said...

How was this handled prior to 1.2?

Anonymous said...

Amiable fill someone in on and this fill someone in on helped me alot in my college assignement. Say thank you you seeking your information.

Anonymous said...

Sorry for my bad english. Thank you so much for your good post. Your post helped me in my college assignment, If you can provide me more details please email me.