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.
A:
HQL does not support union
nor intersect
. You probably can achieve it via Criteria
or native SQL.
o.k.w
2009-10-29 10:53:35
A:
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...
Dani
2009-10-29 10:54:11
o.k.w link clears this. it does not support union at all.
Dani
2009-10-29 10:55:17
@Dani: Here!!! http://stackoverflow.com/questions/247103/how-do-you-do-a-union-of-two-tables-in-nhibernate
o.k.w
2009-10-29 11:07:37
+1
A:
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.
Stefan Steinegger
2009-10-29 11:11:13