cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrus Adamchik <>
Subject Re: Bug when doing joint prefetching on a to-many relationship using a fetch limit?
Date Mon, 13 Mar 2017 13:53:11 GMT

> On Mar 13, 2017, at 4:41 PM, Hugi Þórðarson <> wrote:
> Hi all.
> I’m getting some unexpected behaviour when applying a fetch limit and doing joint prefetching
on a to-many relationship. In short, the number of objects returned is always lower than the
actual fetch limit I set. Problem goes away if I do a disjoint prefetch or no prefetching
at all.
> I created a tiny self-contained maven project that demonstrates the problem:
> The source for the main class in that project (that can be run to show what happens):
> Anyone run into this before?
> Cheers,
> - hugi

Yeah, that's a limitation described here: [1]. Also mentioned in the docs, though it may be
hard to spot [2]:

"Disjoint-by-ID Prefetching Semantics [..] Moreover this is the only type of prefetch that
can handle SelectQueries with fetch limit. Both joint and regular disjoint prefetches may
produce invalid results or generate inefficient fetch-the-entire table SQL when fetch limit
is in effect."


Andrus Adamchik
Twitter: @andrus_a

View raw message