org.springframework.data.jpa.repository.query.abstractjpaquery $ tuple

发布于 2025-02-09 13:36:39 字数 1095 浏览 1 评论 0原文

我不知道为什么我会遇到这个错误。所有错误

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_从员工a左JOIN paymentformula b on a.external_id = b.user_id”,nativequery = true) 列出get employeeandpayment();

公共类Paymayforuladto {

private String externalId;

private String employeeName;

private String employeeLastName;

private String pasword;

private String employeeEmail;

private String employeeExternalId;

private String employeeId;

}

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;

}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

奢欲 2025-02-16 13:36:40

使用接口投影或添加sqlresultset映射。
请参阅本文: https://thorben-janssen.com/spring -data-jpa-dto-native-queries/

Use interface projection or add SqlResultSet mapping.
See this article : https://thorben-janssen.com/spring-data-jpa-dto-native-queries/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文