Reputation: 7
I dont know why I am getting this error. All error
There was an unexpected error (type=Internal Server Error, status=500).
No converter found capable of converting from type [org.springframework.data.jpa.repository.query.AbstractJpaQuery$TupleConverter$TupleBackedMap] to type [com.example.entities.dtos.PaymentFormulaDto]
org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type [org.springframework.data.jpa.repository.query.AbstractJpaQuery$TupleConverter$TupleBackedMap] to type [com.example.entities.dtos.PaymentFormulaDto]```
my query is below
@Query(value="select a.external_id as externalId_ from employee a left join paymentformula b on a.external_id = b.user_id",nativeQuery=true) List getEmployeeAndPayment();
public class PaymentFormulaDto {
private String externalId;
private String employeeName;
private String employeeLastName;
private String pasword;
private String employeeEmail;
private String employeeExternalId;
private String employeeId;
}
Upvotes: 0
Views: 2246
Reputation: 188
Use interface projection or add SqlResultSet mapping. See this article : https://thorben-janssen.com/spring-data-jpa-dto-native-queries/
Upvotes: 0