-
Notifications
You must be signed in to change notification settings - Fork 1.5k
DTO Projection not working with specification #2959
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
I have changed the repository invoking method to
and the repository interface to
But it gives the following error now:
|
I tried invoking the repository using findBy:
I also tried
But the select query has all the columns. |
I looked at the classes FetchableFluentQueryByPredicate and FetchableFluentQueryBySpecification. Both of them add the properties in the hint and not the select part of the query, and the postgres driver probably is not honouring it. I am using postgres solution provided by aws and as per documentation hints are not supported: Probably In the "getQuery" method of SimpleJpaRepository we need to pass properties and change "query.select(root);" to "query.multiselect(root.get(propertyName))" Is there any way to solve this problem |
Specifications aren't accepted as parameters in derived queries, therefore We currently do not support DTO projections because we do not differentiate what to select, we just select the entity |
Closing this as duplicate of #487 |
I was trying to use projection with specification, but I am getting the error:
Caused by: org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type [com.entity.ParticipationEntity] to type [com.entity.TenantOnly]. The reason being select query has all the columns and not just the ones present in TenantOnly.
projection interface
Spring Data repository
build versions
org.springframework.boot:spring-boot-starter-data-jpa:3.0.5
org.postgresql:postgresql:42.6.0
The text was updated successfully, but these errors were encountered: