Skip to main content

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

Hi Mike,

This should be a FAQ :)

Please see the recent thread "Conditional LEFT JOIN in JPQL".

I would suggest you vote for

https://bugs.eclipse.org/bugs/show_bug.cgi?id=312146

Regards

Bernard

On Sat, 15 May 2010 14:58:52 -0700, you wrote:

>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
>successful:
>select * from event left join source ON event.id = source.event_id left
>join transaction ON source.id = 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?
>
>Thanks,
>Mike
>
>_______________________________________________
>eclipselink-users mailing list
>eclipselink-users@xxxxxxxxxxx
>https://dev.eclipse.org/mailman/listinfo/eclipselink-users



Back to the top