ymartin wrote:
Hello,
To use "UNION" and keep Hibernate flexibility, I would like to write the following code:
. create a Query "q1" from a first Criteria for object A.class
. create a Query "q2" from a second Criteria for object A.class
And then generate both SQL statements to create a SQL query with mapping to object "A":
. Query unionQuery = session.createSQLQuery(q1.toSQLString() + " UNION " + q2.toSQLString()).addEntity(A.class)
I have looked at API but I have not found a way to get the SQL statement from a query. Does a sort of "toSQLString" exist ? Is my idea possible ?
Thank you in advance for your help
According to the FAQ there is no support (yet) for UNION, INTERSECTION and any other set operations - unfortunately;
I am waiting myself for this feature ;) Anybody knows when this issue will be tackled ?
Cheers.