-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed Projection does not work with @EntityGraph [DATAJPA-1501] #1814
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
Comments
Oliver Drotbohm commented This looks like a wild mixture of entity graphs and projections, which we didn't quite anticipate before. What's the reason you need to mix those up? |
asfernandes commented If the projection is used directly (no generics) in findFetchCidade, the same thing happens |
asfernandes commented Oliver Drotbohm I don't need the getSomething. It's used just to make the thing work. My real case is some nesting of projections (Endereco -> Cidade -> Estado -> Pais), that I need some fields of each, and I want to have LAZY in the entities |
asfernandes commented Oliver Drotbohm you say the problem is the mixture of entity graphs and projections, but for me the problem seems to be about nested projections not creating a JPQL selecting the fetched entities. At least that seems to be what the error says. It's weird because nested projections is documented as something supported |
Just found this after logging my issue (#2709) |
This repo demonstrates that entity graph is ignored in Spring-Data when it is used in combination with closed-projection: https://github.com/Eng-Fouad/spring-closed-projection-entity-graph |
As a workaround:
However, the generated query will include all columns in SELECT clause, as the return type is |
Any updates regarding this issue? |
The actual question is: What should happen if a closed projection and an |
asfernandes opened DATAJPA-1501 and commented
I have entities that map others entities using
@ManyToOne(fetch = FetchType.LAZY)
.Then I have created a repository interface with a method using
@EntityGraph
:And created projection interfaces:
When I use findFetchCidade passing a EnderecoProjection, I have this error:
Note that if I uncomment the
@Value
annotation, the projection becomes opened and then no error happensAffects: 2.1.4 (Lovelace SR4)
The text was updated successfully, but these errors were encountered: