-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Work-around UNION proposal
PostPosted: Fri Jul 06, 2007 5:07 am 
Newbie

Joined: Mon Jun 04, 2007 9:47 am
Posts: 4
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


Top
 Profile  
 
 Post subject: Re: Work-around UNION proposal
PostPosted: Tue Aug 07, 2007 9:46 am 
Newbie

Joined: Thu May 03, 2007 6:24 am
Posts: 8
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.