| As a suggestion... you can skip HQL validation by adding an intermediate function called "unionQuery", the suggested sintax would be like this: Query q = session.createQuery(HQL1).unionQuery(HQL2).unionQuery(HQL3); That way you can reuse the same HQL validation and the only left thing to do is to validate each query returned values/types; I fixed this for my requirement by now doing the following (i'm simplifying a lot this example, is only to give you the idea): List q = new ArrayList(); q.add("HQL1"); q.add("HQL2"); q.add("HQL3"); List result = null; for(String hql : q) { if(result == null) { result = session.createQuery(hql).list(); } else { result.appendAll(session.createQuery(hql).list()); } } |