Hopefully, this is a simple question.
I’m doing a join in HQL along the lines of:
FROM Apple a, Orange o WHERE a.price = o.price AND a.price > 1.99
When I do this, I get back a collection representing the join. However, each element in the collection is actually another collection containing the related apple and orange.
What I want is a list of apples and what I’m getting is a list of apples and oranges. Logically, I’m looking for:
All apples priced greater than 1.99 only when
there is also an orange at the same price.
My actual problem is 50X more complex than this but I’ve simplified it to the basic problem. How do I correct/modify this HQL query to only give one type of object?
Modify your query slightly: