hql 获取某些属性唯一的对象
我正在尝试执行 hql 查询,该查询返回具有不同属性值的对象列表。以下是我的伪代码:
string hql = @"select distinct m from Merchandise m
where m.Serial is unique"
我在 NHibernate 之上使用 Castle ActiveRecord。我在这个问题上花了半天,但找不到正确的 HQL 语法来完成它。有人可以告诉我该怎么做吗?
I am trying to perform an hql query which returns a list of objects with distinct property value. Following is my pseudo code:
string hql = @"select distinct m from Merchandise m
where m.Serial is unique"
I am using Castle ActiveRecord on top of NHibernate. I have spent half a day on this problem but couldn't find the correct HQL syntax to do it. Can someone tell me what to do?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
像这样的事情应该可以解决问题:
假设商品的 Id 只是一个名为 Id 的属性。
Something like this should do the trick:
This assumes the Id of Merchandise is just a property called Id.