[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] How to left join with expression

Hi Andreas,

  What code do you use to build your query?  What is the resulting SQL?

I would expect that you could add a joined expression to your query using Expression.getAllowingNull(<attribute>)

-Tom

Andreas König wrote:
Hey there...

I think, I didn't really get the expression language yet.
I have two classes:

Offer and Publication

An Offer can have multiple publications, from which only the youngest is interesting for me.
For architectural reasons, the offer-object has no reference to the publication(s). Only the publication has a refence to the object.


How do I get an SQL like this with expression language?

SELECT     offer.id,
    publication.id
FROM
    Offer offer
LEFT OUTER JOIN PUBLICATION pub ON pub.offer_id = offer.id
WHERE NOT EXISTS (not so important subquery)


I tried different ExpressionBuilders, but nothing seemed to work. The result was always wrong way around: pub left outer join offer.


Thanx in advance!

Andreas