How do you do a union of two tables in NHibernate?

风流意气都作罢 提交于 2019-12-10 15:35:02

问题


I need to do a union of two tables using NHibernate and HQL. I have found very little help online, and I want to know if it is possible and if so how?


回答1:


Found my answer:

http://www.hibernate.org/117.html#A21

It doesn't currently support union or intersect.




回答2:


You could use a named sql-query and do the union in raw SQL. NHibernate will be able to populate entity instances from the sql-query and return those as the query result. See here and here.




回答3:


I don't believe HQL supports unions, but you can write your own record transformer and author the sql by hand.



来源:https://stackoverflow.com/questions/247103/how-do-you-do-a-union-of-two-tables-in-nhibernate

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