Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JPA - JPQL - JOINS

843830Dec 5 2007 — edited Aug 21 2008
Hi everyone !

I met a problem using JPQL JOINS. I have the following query :
SELECT c FROM Category c 
LEFT JOIN c.products p
LEFT JOIN p.rebate r
WHERE c.id = :cat
Ok, it works well but i want to filter the rebates wich are valid, between two stamps, but if a rebate doesn't exist between these stamps I want to retrieve it. With standard SQL-like query I should do this ...
SELECT c FROM Category c
LEFT JOIN c.products p
LEFT OUTER JOIN p.rebate r ON(r.startDate >= CURRENT_TIMESTAMP AND r.endDate <= CURRENT_TIMESTAMP)
WHERE c.id = :cat
But I know that there's no ON clause with JPQL JOIN ... How can I recreate this behavior ?

Thanks for your help !

Edited by: bugalood on Dec 5, 2007 3:04 AM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 18 2008
Added on Dec 5 2007
3 comments
446 views