解决问题:Failed to convert from type [java.lang.Object[]] to type

版权声明:Soulmate_Min专属 https://blog.csdn.net/Soulmate_Min/article/details/82761324

报错信息:org.springframework.core.convert.ConversionFailedException: Failed to convert from type [java.lang.Object[]] to type

出现该错误的原因是因为在当前的***Repository中,查询了其他的实体.

public interface InvoiceRepository extends JpaRepository<Invoice,String>{
	
	@Query(value = "select * from invoice where user_id=?1", nativeQuery = true)
	List<Invoice> findInvoiceAll(String userId);

}

每个实体都应有各自对应的***Repository,实体要与数据库表中字段相对应, 请仔细检查。

个人出现该问题的原因是继承的JpaRepository<Invoice,String>没有改成相应的实体。

改好之后, 就不会报错。

在实体中也要加入@Entity 注解。

改好即可。

猜你喜欢

转载自blog.csdn.net/Soulmate_Min/article/details/82761324