Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » left outer join with JPQL(Help with joins)
left outer join with JPQL [message #530724] Fri, 30 April 2010 16:04 Go to next message
Larry  is currently offline Larry Friend
Messages: 30
Registered: December 2009
Member
Sorry for being a newbie! I guess I don't quite get JPQL.

I am trying to execute the followin JPQL:

select a.f1,a.f2,b.f3 from A a LEFT OUTER JOIN B b ON (a.f1 = b.f1 and a.time = b.time)
where a.id = b.id and
a.match = b.match;

I noticed that in a lot of joins and/or outer joins - you use syntax where the entity your joining is mapped in the first entity your selecting data from. For instance

select c.one,d.two from C c OUTER LEFT JOIN c.d d
** But this implies that the entity is mapped in the first entity 'C'.

The SQL that I am trying to perform is:
select a.f1,a.f2,b.f3 from A a LEFT OUTER JOIN B b
where a.id = b.id and
a.match = b.match
and a.f1 = b.f1
and a.time = b.time;

Again in my scenario, Entity A does not contain Entity B.

Thanks
Re: left outer join with JPQL [message #531068 is a reply to message #530724] Mon, 03 May 2010 15:22 Go to previous message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

JPQL does not support an ON clause in outer joins. You can only define outer joins on relationships.

You either need to add the relationship, use an inner join, or use a native SQL query.

Feel free to log an enhancement request to have this support added.


James : Wiki : Book : Blog : Twitter
Previous Topic:JPA/JTA eclipselink oracle proxy authentication problem
Next Topic:How to map an association with an Enum
Goto Forum:
  


Current Time: Fri Apr 19 19:45:34 GMT 2024

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

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

Back to the top