Cosium / spring-data-jpa-entity-graph

Spring Data JPA extension allowing full dynamic usage of EntityGraph on repositories
MIT License
469 stars 52 forks source link

Use Specfications without extra join #32

Closed mosiobahmani closed 4 years ago

mosiobahmani commented 4 years ago

hi Thanks for your library that makes me very happy. i have a question : how to use Specfication without extra join (Join<x,y>) with our entityGraph? in our namedEntityGraph actually we are joining Entities together and now i want to set where clause on the one of those subGraph to fetch with that. is ther any way? (sorry for my bad English)

reda-alaoui commented 4 years ago

Hi,

I didn't understand your question. Can you provide an example?

mosiobahmani commented 4 years ago

When we use entityGraph and subgrpah actualy like writing left outer join.ok? Example:

Select person.name, person.lastname, city.name, city.code From tbl_person person Left outer join tbl_city city On person.city_id = city.id

Its the query that hibernate create for this: @NamedEntityGraph("person_city" , attributes:"city"

Now i want use specification on my entityGraph, but i need to set where cluse with city (or other attributes) Like:

Select person.name, person.lastname, city.name, city.code From tbl_person person Left outer join tbl_city city On person.city_id = city.id Where city.name = "NewYork"

How can i do it ? ( i dont want to use another extra Join<person,City> )

Tnx

On Thu, Jan 9, 2020, 11:16 PM Réda Housni Alaoui notifications@github.com wrote:

Hi,

I didn't understand your question. Can you provide an example?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Cosium/spring-data-jpa-entity-graph/issues/32?email_source=notifications&email_token=AHOLUPETRN7D7FIQ3E4ANZ3Q455LFA5CNFSM4KE27EE2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEIRRLSY#issuecomment-572724683, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHOLUPGNRZTHANSFTR337HLQ455LFANCNFSM4KE27EEQ .

reda-alaoui commented 4 years ago

IMO, you can't do it differently. Moreover, this library is not meant to solve such issue.

I think your question should be addressed to the JPA specification maintainers.