You can extend the Oracle dialect and add BITAND as a recognized HQL function:
public class OraclePlusDialect : Oracle10gDialect { public OraclePlusDialect() { RegisterFunction("bitand", new StandardSQLFunction("bitand", NHibernateUtil.Int32)); } }
Then you can fulfill your request as follows:
var objects = _session.CreateQuery("select c from MyClass c where bitand(c.someInteger, :param) > 0") .SetParameter("param", otherInteger) .List<MyClass>();
Perhaps Oracle has a type conversion problem because BITAND returns a rarely used data type. If so, change your HQL query to:
select c from MyClass c where bitand(c.someInteger, :param) + 0 > 0
source share