没有发现能够从类型[java.math.biginteger]转换为实体的转换器

发布于 01-23 16:19 字数 1708 浏览 4 评论 0原文

我正在尝试从数据库中获取交易列表,这是我面临的错误。

“ trace”:“ org.springframework.core.convert.convert.conversionfailedexception:无法从type [java.lang.object []]转换为type [com.wallet.sendmoney.entities.entities.transactionentity] ,1,null,null,kes,null,123456,lqalvzcfjmu6,null,2547xxxxxxxx3,61234,负载钱包,无效,无效,无效,无效,null,null,null,null,ws322,null} null is org is org.ssprespramewrame.core。 .ConverTernOtFoundException:未发现转换器能够从类型[Java.math.biginteger]转换为type [com.wallet.sendmoney.entities.entities.transactionentity]

@Repository
public interface TransactionsRepository extends JpaRepository<LoadWalletEntity, Long> {

@Query(value = "SELECT * FROM transactions_attempts WHERE mobile_number= :mobile_number", nativeQuery = true)
List<TransactionEntity> getAllByPhoneNumber(@RequestParam String mobile_number);
}

器 我的实体课程:

@Entity(name = "transactions_attempts")
@Table
@Data
@NoArgsConstructor
@AllArgsConstructor
public class LoadWalletEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String currency;
@Column(name = "mobile_number")
private String mobileNumber;
private String transactionRef;
private String merchantCode;
private Integer amount;
private String networkCode;
private String reason;
private String statusCode;
private String merchantReference;
private String merchantRequestId;
private String checkoutRequestId;
private Integer resultCode;
private String resultDescription;
private String billRefNumber;
private Date transactionDate;
@Column(name = "customer_mobile")
private String customerMobile;
private String thirdPartyTransId;
}

我在这里可能会想念或做错什么。 提前致谢

I'm trying to get a list of transactions from database and this is the error I'm facing.

"trace": "org.springframework.core.convert.ConversionFailedException: Failed to convert from type [java.lang.Object[]] to type [com.wallet.sendmoney.entities.TransactionEntity] for value '{1, 1, null, null, KES, null, 123456, LQALVZCFJMU6, null, 2547XXXXXX3, 61234, Load wallet, null, null, null, null, null, WS322, null}'; nested exception is org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type [java.math.BigInteger] to type [com.wallet.sendmoney.entities.TransactionEntity]

I'm using JPA @Query annotation and here is my repository

@Repository
public interface TransactionsRepository extends JpaRepository<LoadWalletEntity, Long> {

@Query(value = "SELECT * FROM transactions_attempts WHERE mobile_number= :mobile_number", nativeQuery = true)
List<TransactionEntity> getAllByPhoneNumber(@RequestParam String mobile_number);
}

Here is my entity class:

@Entity(name = "transactions_attempts")
@Table
@Data
@NoArgsConstructor
@AllArgsConstructor
public class LoadWalletEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String currency;
@Column(name = "mobile_number")
private String mobileNumber;
private String transactionRef;
private String merchantCode;
private Integer amount;
private String networkCode;
private String reason;
private String statusCode;
private String merchantReference;
private String merchantRequestId;
private String checkoutRequestId;
private Integer resultCode;
private String resultDescription;
private String billRefNumber;
private Date transactionDate;
@Column(name = "customer_mobile")
private String customerMobile;
private String thirdPartyTransId;
}

What could I be missing or doing wrong here.
Thanks in advance

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

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

发布评论

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

评论(2

生死何惧 2025-01-30 16:19:02

您正在尝试查询交易范围的列表

,但是您的存储库是通过

extends JpaRepository<LoadWalletEntity, Long> {

loadwalletentity进行的。

应该是

extends JpaRepository<TransactionEntity, Long> {

you are trying to query a list of TransactionEntity

but your Repository is extends with

extends JpaRepository<LoadWalletEntity, Long> {

what's this LoadWalletEntity????

it should be

extends JpaRepository<TransactionEntity, Long> {
十级心震 2025-01-30 16:19:02

尝试此解决方案

@Entity
@Table(name = "transactions_attempts")

@Entity(name = "transactions_attempts")
@Table

Try this solution please:

@Entity
@Table(name = "transactions_attempts")

instead of

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