Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specification adds duplicate join when query has been built manually with existing join (Spring Boot 3.x) #256

Open
janar-rahumeel opened this issue Aug 30, 2023 · 0 comments

Comments

@janar-rahumeel
Copy link

janar-rahumeel commented Aug 30, 2023

Specification has annotation @Join(path = "googleSearchResults", alias = "gsr"), and @Spec(params = "googleSearchResultSourceQuality", path = "gsr.sourceQuality", spec = Equal.class)}) when I build my query manually that contains already this join

Join<GoogleSearch, GoogleSearchResult> googleSearchResults = googleSearch.join("googleSearchResults", JoinType.LEFT);

and calling

Predicate wherePredicate = specification.toPredicate(googleSearch, criteriaQuery, criteriaBuilder);

provider creates a duplicate join

select
        distinct g1_0.id c0,
        g2_0.name c1,
        g1_0.QUERY c2,
        count(g3_0.ID) c3 
    from
        GOOGLE_SEARCH g1_0 
    join
        GOOGLE_LOCATION g2_0 
            on g2_0.id=g1_0.GOOGLE_LOCATION_ID 
    left join
        GOOGLE_SEARCH_RESULT g3_0 
            on g1_0.id=g3_0.GOOGLE_SEARCH_ID 
    left join
        GOOGLE_SEARCH_RESULT g4_0 
            on g1_0.id=g4_0.GOOGLE_SEARCH_ID 
    where
        g1_0.SEARCH_REQUEST_ID=? 
        and g4_0.SOURCE_QUALITY=? 
        and 1=1 
    group by
        c0,
        c1,
        c2 offset ? rows fetch first ? rows only
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant