Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Is UNION supported in a subquery?
Is UNION supported in a subquery? [message #1053519] Mon, 06 May 2013 11:12 Go to next message
Iñaki Serrano Zabaleta is currently offline Iñaki Serrano Zabaleta
Messages: 1
Registered: May 2013
Junior Member
I've been trying to run the following JPQL query without success:
select rr from SomeTable rr where rr.id in ( 
    select t1.id from SomeTable t1 where t1.neighboringTable IS NULL 
    union 
    select t2.id from SomeTable t2 where t2.neighboringTable.id = :param
) order by rr.name asc


I've tried several ways to get the same results, like putting the subquery in the FROM clause, always with the same "results":
[137, 137] The right parenthesis is missing from the IN expression.
[221, 223] The query contains a malformed ending.


As soon as I remove the UNION, everything works fine, so I am starting to wonder whether UNION is supported by Eclipselink 2.4.1 as part of a subquery. And if it is not, how could I get the same results by other means?
Re: Is UNION supported in a subquery? [message #1053781 is a reply to message #1053519] Tue, 07 May 2013 14:53 Go to previous message
James Sutherland is currently offline James Sutherland
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

Looks like it is not supported. You can log a bug to have the support added.

You could change your query to use two INs, two subqueries and OR them.


James : Wiki : Book : Blog : Twitter
Previous Topic:Convert .NET DateTimeOffset <--> Jodatime DateTime (utc)
Next Topic:Unique Constraints and Delete and Insert Order - Constraint Violation
Goto Forum:
  


Current Time: Fri Oct 24 09:36:45 GMT 2014

Powered by FUDForum. Page generated in 0.02621 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software