Proof-of-concept for top-level UNION in HQL

66 views
Skip to first unread message

Dmitry Kalyanov

unread,
Mar 29, 2015, 9:10:38 AM3/29/15
to nhibernate-...@googlegroups.com
I need to be able to use union/union all/except from NHibernate and I've been trying to see what it would take to support this in NHibernate.
So far I've made a proof-of-concept (at https://github.com/dmitryvk/nhibernate-core/commit/869443d861232b8c15f150c7e597e5bcc7ca7863) which seems to support some basic trivial cases (which are added to tests).

Basically, what I do is the following:
1) HQL parser allows UNION at the top-level, yielding AST such as the following (using s-expression notation):
 (UNION
  (QUERY ...)
  (QUERY ...))
2) HqlSqlWalker and SqlGenerator also allow UNION at the top-level
3) New HQL AST node is added for UNION

I'd like to have this code reviewed and receive some feedback about this proof-of-concept implementation. What's missing in it? Am I in the right direction? Is there a documentation for how NHibernate generates SQL query (I'm having trouble navigating around HqlSqlWalker.ProcessQuery(), FormClauses, FormElements and so on)?

Ricardo Peres

unread,
Mar 29, 2015, 2:31:49 PM3/29/15
to nhibernate-...@googlegroups.com
There is an open issue on Jira for this. Why don't you submit a pull request?

RP
Reply all
Reply to author
Forward
0 new messages