Vlad K Vlad K - 5 months ago 45
Java Question

Eclipselink fetch-join lazy associations of a subclass

I want to fetch a lazy association, which is present on a subclass only.
In Hibernate, it is possible to use fetch treat joins, for example

select a from A a left join fetch treat(a.parent as Child) u left join fetch child.some

is an association which is present on
entity only.

But we use Eclipselink ver 2.6.3. AFAIK JPA doesn't cover this problem, fetch treat is not supported by Eclipse. I have already tried eclipse fetch hints with no success.

Thanks in advance


This is not supported in EclipseLink by default (I believe it is a bug). But there is working workaround in Joiner library (InheritanceJoiningCustomizer in https://github.com/encircled/Joiner)