Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] Limiting the returned children in a query selecting the parent

I have the following relationship:
event->source->transaction, where -> represents a bidirectional
one-to-many relationship.

I am trying to select the Event object map for which it's related
transaction.status field = 'FAILED', with that object map containing
ONLY the transactions that meet that criteria. The following sql is
select * from event left join source ON = source.event_id left
join transaction ON = transaction.source_id where
transaction.status = 'FAILED';

The following JPQL ends up returning the correct Event, but it also
contains all it's Transaction children, not just the ones with
transaction.status = 'FAILED':
select e FROM Event e LEFT JOIN e.sources s LEFT JOIN s.transactions t
where t.status = 'FAILED'

Any idea's?


Back to the top