I have a situation where I have a table where some of the columns are nullable, but I want my NHiber开发者_Go百科nate-based entities to expose those values as non-nullable fields. If I do this with a normal mapping, NHibernate assigns the defult value of the type to the entity's field in the case of a null value. I would like to change this behavior so that instead an exception is thrown. Is this possible?
I think you have to change your mapping and add a not-null="true" attribute.
精彩评论