I am working with a legacy database and am trying to convert a char to an int for a many-to-one mapping. I know this isn't a great idea but I'm stuck with the schema as it is.
I have tried to do this with the following mapping but have found that NHibernate is adding the table name alias onto the keyword SQL_INTEGER
.
<many-to-one name="host" formula="CONVERT(alloc_code, SQL_INTEGER)" />
Generates the SQL
CONVERT(hostplacem0_.alloc_code, hostplacem0_.SQL_INTEGER)
I have found this post but the solution is not a workable one for my situation.
One thing to note is that we have rolled our own dialect for the DBMS we use (Sybase Advantage Database Server) since NHibernate does not support it out of the box. Therefore I have the option of amending this to address this issue. I have already tried registering SQL_INTEGER
as a keyword but that didn't help.