Nhibernate GenericADOException could not execute query

During the mapping process or after a data model change you may receive this error.

image

The error message being: {“could not execute query\r\n[ select from TABLE ]”} with an inner exception of

  • {“Ungültiger Spaltenname ‘SPALTEN NAME’.”}
  • {“Invalid column name ‘COLUMN NAME’.”}

I received this error when I was creating a many-to-one relationship between 2 classes, for example Order to Customer. I wanted to have access to the Customer when I retrieved a specific Order. The error occurred because the column name originally entered into the key element had been changed.

The key column ‘generally’ represent the foreign key relationship between tables. Updating the column attribute of the key element with the current column name resulted in the resolution of this exception.