开发者

How to get this kind of query in NHibernate : SELECT DISTINCT FileName From CustomerFile WHERE name = ' ' AND timeframe = ''

Please do not redirect me towards the other similar kinds of HQL in Stackoverflow, because they did not work for me. I really appreciate your direction on it. Thanks.

Reproducing this kind of query in Nhibernate with ICriteria API :

 SELECT DISTINCT FileName From CustomerFile WHERE name = ' ' AND timeframe = '' 开发者_JS百科


Why not just use the custom SQL that you've sketched in, above, and map the result column to Strings? Why jump through ORM hoops to do something simple?

session
 .CreateSQLQuery("SELECT DISTINCT FileName From CustomerFile WHERE name = ' ' AND timeframe = ''")
 .AddScalar("FILENAME", NHibernateUtil.String)
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜