Possibility to LEFT JOIN FETCH for @EntityGraph [DATAJPA-1124] #1469
Labels
in: core
Issues in core support
status: declined
A suggestion or change that we don't feel we should currently apply
type: enhancement
A general enhancement
Yan Tuizhi opened DATAJPA-1124 and commented
Assuming I have the following entites
and a repository
JpaRepository<House, Long>
. If want to fetch all houses with all associations, this is currently not possbile with the@EntityGraph
annotation. If i have the following method in the repository:then an exception will be thrown (shopWindows is not a property of House). However, if I set all assocations to
FetchType.EAGER
und use thefindAll
method, all Shop instances are found with all assocations.It would be very helpful (especially for real world scenarios with complex inheritance relations), if the repository would automatically detect whether a given attributePath belongs to derived class and would in that case make a
LEFT JOIN FETCH
. This should also be possbile for all levels of association (e.g. in case there are different types of Room or ShopWindow).My current workaround is the following:
Alternatively, I guess I could create a repository for each derived class, but that would duplicate a lot of code.
Affects: 1.11.3 (Ingalls SR3)
The text was updated successfully, but these errors were encountered: