当前位置: 首页 > 知识库问答 >
问题:

找不到能够从类型[java.math.BigInteger]转换为实体的转换器

昌砚
2023-03-14

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

"跟踪":"org.springframework.core.convert.ConversionFailedException:无法从类型[java.lang.Object[]]转换为类型[com.wallet.sendmoney.entities.TransactionEntity]值'{1,1, null, null, KES, null,123456, LQALVZCFJMU6, null,2547XXXX3,61234,加载钱包, null, null, null, null, null, WS322, null}';嵌套异常org.springframework.core.convert.ConverterNotFoundException:找不到能够从类型[java.math.BigInteger]转换为类型[com.wallet.sendmoney.entities.TransactionEntity]的转换器

我正在使用JPA@Query注释,这是我的存储

@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;
}

我在这里可能错过了什么或做错了什么。提前致谢

共有1个答案

公良天逸
2023-03-14

请尝试此解决方案:

@Entity
@Table(name = "transactions_attempts")

代替

@Entity(name = "transactions_attempts")
@Table
 类似资料: