I read with excitement the first article that popped up in google -- it was exactly my problem. I have an object model with a non-null date field, but the underlying database field was nullable, and had a null value. It was a DateTime. nHibernate set the value to .Net's Date.MinValue, then tried to save it back, yielding an error.
The solution in the article: Simply use "DateTime?" in the domain model.
That won't work for us.
Here's the thing: We're doing a major refactor, which includes data migrations from one schema to another, moving from ADO to nHibernate, etc., complex stuff. Bottom line: The object model is correct as it is, it's NOT a nullable DateTime (A "CreatedDate"). Setting it to DateTime? would work technically, but it's wrong domain-ly. What I REALLY want is for nHibernate to stop being so helpful and just throw an error when it runs across an attempt to load a null DateTime into a non-nullable domain object. I believe this will help us to identify these issues much more quickly.
I know nHibernate is highly configurable/mappable... is there a way to achieve this behavior, and what's the best way to do it...?
Thanks in advance for any help!