0

请不要将我重定向到 Stackoverflow 中其他类似的 HQL,因为它们对我不起作用。我真的很感谢你的方向。谢谢。

使用 ICriteria API 在 Nhibernate 中重现这种查询:

 SELECT DISTINCT FileName From CustomerFile WHERE name = ' ' AND timeframe = '' 
4

1 回答 1

1

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)
于 2009-10-15T15:47:31.970 回答