spring-data-jpa
spring-data-jpa copied to clipboard
Allow to add where conditions on subgraphs [DATAJPA-1503]
Sri Ram commented
Person -----> parent entity
Address -----> child entity
Person has one to many relationship with address entity
I'm using @EntityGraph(attributePaths = {"Person", "Person.address"}) to eager fetch the related entities and root entity. I'm unable to specify where condition for related entities for example If I want to filter the address based on a field "AddressType" while using entitygraph, I couldn't able to do that. So I'm trying to figure out if there is a way.
Equivalent SQL:-
select * from Person p join Address a on a.address_id = p.address_id where a.addressType = 'OFFICE';