Bug in fetchgroups? one-to-many relations being added

Encountered while investigating another issue.

I have an entity with a one-to-many and a screen with fetchplans that exclude that one-to-many.

The relation still gets fetched though, problem seems to be in FetchGroupManager 559 → 567

I see that when using a fetchgroup, jpa properties are being added,is there supposed to be a check on range.isMany that is missing?

Im using jmix 1.5 but code seems the same on 2.x

image

Hello Tom!

The lines in FetchGroupManager you referenced is correct part of Lazy Loading mechanism. Reference attributes always added to fetch group with lazy flag (last parameter at line 564 set to true) in order to give an ability to load property on demand.

It seems that the relation gets fetched lazily when it actually accessed. The easiest way to find where it happens is to look thoughtfully who and where uses this property or which UI component related with it.

Alternatively, you can put a breakpoint at field (not method, because it has been modified by ORM) and look who accesses this property. But this aproach has bad side effect: debugger itself can trigger lazy loading by just displaying field value. In order to deal with it, please disable fields evaluation as described in this reply.

Regards,
Dmitry

1 Like

Thanks for the reply. It caused a lot of debugging noise when looking into another issue.

But good to know how lazy loading works.