Does NHibernate HQL support the UNION ALL keyword?

旧巷老猫 提交于 2019-12-11 07:37:46

问题


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.


回答1:


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.




回答2:


HQL does not support union nor intersect. You probably can achieve it via Criteria or native SQL.

Source: https://www.hibernate.org/117.html#A21




回答3:


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...



来源:https://stackoverflow.com/questions/1642873/does-nhibernate-hql-support-the-union-all-keyword

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!