Ok, i was kinda hung up on this one for 3 hours or so.
I added a new column to the database, a boolean one. I mapped it to my domain object, which is also boolean (not nullable). Fired up my project, tried to do the query only to get:
Could not execute query [SQL: SQL not available]
And the inner exception would just be Object reference not set to an instance of an object.
Since the boolean addition was not the only change in the system (i did quite a few of them) i suspected something else going awry. Anyway, google didn’t help much, i did some digging and basically what i come up with is this:
If you are adding a column and mapping it to a non nullable value type, make sure that column is NOT NULL and has DEFAULT value defined.
Hope this saves someone a few hours. I should really read a book on nhibernate….
Leave a Comment