Nhibernate hql获取对象,其中对象';物业是「;“子字符串”;输入值

Nhibernate hql获取对象,其中对象';物业是「;“子字符串”;输入值,nhibernate,activerecord,hql,Nhibernate,Activerecord,Hql,我遇到了和你一样的情况。我的伪代码是 string hql = "select ai from AreaInfo as ai where ai.PhoneSegment is substring of :InputPhoneNumber"; 使用like不会奏效,因为like所做的是 string hql = "select ai from AreaInfo as ai where :InputPhoneNumber is substring of ai.PhoneSegment"; 那么,

我遇到了和你一样的情况。我的伪代码是

string hql = "select ai from AreaInfo as ai where ai.PhoneSegment is substring of :InputPhoneNumber";
使用like不会奏效,因为like所做的是

string hql = "select ai from AreaInfo as ai where :InputPhoneNumber is substring of ai.PhoneSegment";

那么,执行此任务的正确语法是什么?我的环境是NHibernate顶部的Castle ActiveRecord。提前谢谢。

我相信您正在尝试这样做:

select ai from AreaInfo ai where :InputPhoneNumber like concat('%', ai.PhoneSegment)
是这样吗