NHibernate HQL 是否支持 UNION ALL 关键字?
经过广泛的谷歌搜索后,我仍然找不到这个问题的明确答案。我看过的一些旧文章/博客文章说根本不是。有人说可以,如果底层数据库支持的话。是哪一个?我在nhusers群里询问过,目前还没有答案。任何帮助将不胜感激。
After extensive googling, I still can't find a definitive answer to this question. Some old articles/blog posts I've seen say not at all. Some say yes if the underling database supports it. Which is it? I asked on the nhusers group with no answer so far. Any help would be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
NHibernate 不支持联合。结果中始终只有一种类型。
您可以做的是查询基类或接口。 NHibernate 将执行联合来从实体映射到的所有表中获取所有值。
还有
union-subclass
映射策略,这也意味着存在基类或接口。NHibernate does not support union. There is always one type in a result.
What you can do is a query to a base class or interface. NHibernate will perform a union to get all the values from all tables where the entities are mapped to.
There is also the
union-subclass
mapping strategy, which also implies that there is a base class or interface.HQL 不支持
union
也不支持intersect
。您可能可以通过Criteria
或本机 SQL 来实现它。来源:https://www.hibernate.org/117.html#A21
HQL does not support
union
norintersect
. You probably can achieve it viaCriteria
or native SQL.Source: https://www.hibernate.org/117.html#A21
我在某处读到过,虽然我不明白为什么,但事实并非如此。
最好的观察方式就是亲自尝试......
I've read somewhere that it doesn't although I can't figure out why.
the best way to see is to try it your self...