Projections - query using an interface projection returns all fields if there are collections in the projection #2632
Labels
status: waiting-for-feedback
We need additional information before we can continue
status: waiting-for-triage
An issue we've not yet triaged
There are several entities in the project, such as User and enum Role, which is used in the User entity as @ElementCollection.
User entity
Role enum
For the User entity, I created a special projection that includes the following fields, including the role collection:
And a JPA repository with a method that finds by username the user using this projection:
When I call this method, I run into the problem that the query contains all fields, including those not specified in the projection:
But if I remove the collection from the projection, the query starts working correctly:
Can you please tell me what could be the problem? I'm not very experienced in using Spring Data JPA, and I can't figure out if this is a bug or some implementation feature that I missed. I couldn't find any answers in the documentation. Thanks
The text was updated successfully, but these errors were encountered: