开发者

hql get objects where objects' property is "substring" of input value

开发者 https://www.devze.com 2022-12-14 01:33 出处:网络
I am running into similar situation as this post. My pseudo code is string hql = \"select ai from AreaInfo as ai where ai.PhoneSegment is substring of :InputPhoneNumber\";

I am running into similar situation as this post. My pseudo code is

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

Using like wouldn't do the trick because what Like is doing is

string hql = "select ai from AreaInfo as ai where :InputPhoneNumber is substr开发者_StackOverflowing of ai.PhoneSegment";

So, what is the correct syntax to perform this task? My environment is Castle ActiveRecord on top of NHibernate. Thanks in advance.


I believe you're trying to do something like this:

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

Is that it?

0

精彩评论

暂无评论...
验证码 换一张
取 消