left outer join with JPQL [message #530724] |
Fri, 30 April 2010 12:04  |
Eclipse User |
|
|
|
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 11:22  |
Eclipse User |
|
|
|
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.
|
|
|
Powered by
FUDForum. Page generated in 0.05378 seconds