I have to import data from a Lotus Notes database via ODBC. The source data are all varchar fields while some columns actually contain dates and numbers. I mapped those colums with NHibernate to the appropriate types which works for loading but not for comparing (using criteria, e.g. Restrictions.Eq("StoreId", 123)
).
Whenever I execute that I get the OdbcException: [Lotus][ODBC Lotus Notes]Incompatible data types in comparison
If I use a string value in the comparison I get an NHibernate QueryException: StoreId expected type System.Int32, actual type System.String
NHibernate appears to send the value through an OdbcParameter because there's a question mark in the generated SQL query. I use the GenericDialect and NotesSQL ODBC driver version 3.02.
Who can help please?
EDIT: I set up a similar scenario using a SQL Server 2005 database (with also varchar columns) over ODBC which did not produce this problem. Any idea why that is?