NHibernate CreateSQLQuery data conversion from bit to boolean error
- by RemotecUk
Hi,
Im being a bit lazy in NHibernate and using Session.CreateSqlQuery(...) instead of doing the whole thing with Lambda's. Anyway what struct me is that there seems to be a problem converting some of the types returned from (in this case the MySQL) DB into native .Net tyes.
The query in question looks like this....
IList<Client> allocatableClients =
Session.CreateSQLQuery(
"select clients.id as Id, clients.name as Name, clients.customercode as CustomerCode, clients.superclient as SuperClient, clients.clienttypeid as ClientType " +
...
...
.SetResultTransformer(new NHibernate.Transform.AliasToBeanResultTransformer(typeof(Client))).List<Client>();
The type in the database of SuperClient is a bit(1) and in the Client object the type is a bool.
The error received is:
System.ArgumentException: Object of type 'System.UInt64' cannot be converted to type 'System.Boolean'.
It seems strange that this conversion cannot be completed.
Would be greatful for any ideas.
Thanks.