Altinet
  • Home
  • Blog
  • Contact





Note to self: NHibernate – Adding nullable columns for non nullable value type properties

On 11 Jan, 2011
Uncategorized
By : Bruno Samardzic
No Comments
Views : 3603

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



Previous Post Next Post 

About The Author

Bruno Samardzic


Number of Posts : 45
All Posts by : Bruno Samardzic

Leave a Comment

Click here to cancel reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>





Recent Posts

  • Angular vs React: round 2
  • Why programming is hard
  • Orchard Workflows, undocumented gem
  • The React Redux
  • React.js invoicing CRUD application, part 2: Description

Recent Comments

  • Angshuman on Animation for starred grid rows and columns using xaml
  • Advanced Excel Training in Lucknow on Angular vs React: round 2
  • Reginald Sophomore on My example of Angularjs directive
  • Slobodan on Angular and Breeze – story so far.
  • Bruno Samardzic on Reaction to Ember-forged Durandal Angularly Knocking out my Backbone, or my JS MVC framework research conclusion.

Contact

Altinet d.o.o.

OIB: 97429091194

Čulinečka cesta 146, Zagreb

Tel: +385 (1) 2946 819

Mob: +385 (98) 210 756

IBAN: HR4323400091110406470

Latest tweets