Vlad K Vlad K - 1 year ago 94
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

Answer Source

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)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download