I want to use own sql functions in my hql queries. so I defined a subclass for MsSql2005Dialect:
Code:
public class SqlServerDialect : MsSql2005Dialect
{
public SqlServerDialect()
: base()
{
RegisterFunction("bit_not", new SQLFunctionTemplate(NHibernateUtil.Int32, "~?1"));
RegisterFunction("bit_and", new VarArgsSQLFunction(NHibernateUtil.Int32, "(", "&", ")"));
RegisterFunction("bit_or", new VarArgsSQLFunction(NHibernateUtil.Int32, "(", "|", ")"));
}
}
But in my queries these functions are not replaced. So I get the SqlException, that the function is not recognized...
Any ideas?
bit_and(x, y) in hql should be replaced with (x & y) in sql query.