Java org.springframework.core.convert.ConverterNotFoundException:未找到能够从类型Account转换为类型AllAccount的转换器
我使用SpringBoot和JPA调用db, 我也有例外 org.springframework.core.convert.ConverterNotFoundException:否 发现转换器能够从类型转换 [com.xxx.central.model.Account]输入 [com.xxx.central.model.AllAccount] 下面是我的代码 Account.javaJava org.springframework.core.convert.ConverterNotFoundException:未找到能够从类型Account转换为类型AllAccount的转换器,java,spring-boot,jpa,Java,Spring Boot,Jpa,我使用SpringBoot和JPA调用db, 我也有例外 org.springframework.core.convert.ConverterNotFoundException:否 发现转换器能够从类型转换 [com.xxx.central.model.Account]输入 [com.xxx.central.model.AllAccount] 下面是我的代码 Account.java @Entity @Table(name = "account") public class Account im
@Entity
@Table(name = "account")
public class Account implements Serializable {
@Entity(name="allAccounts")
@Table(name = "account")
public class AllAccount implements Serializable {
@RepositoryDefinition(domainClass = Account.class, idClass = Integer.class)
public interface AccountRepository extends CrudRepository<Account, Integer>
{
public List<AllAccount>
findByIsActiveAndClientNameIgnoreCaseContainingOrderByAccountCreatedDesc(
Boolean active, String clientNameSearchString);
}
AllAccount.java
@Entity
@Table(name = "account")
public class Account implements Serializable {
@Entity(name="allAccounts")
@Table(name = "account")
public class AllAccount implements Serializable {
@RepositoryDefinition(domainClass = Account.class, idClass = Integer.class)
public interface AccountRepository extends CrudRepository<Account, Integer>
{
public List<AllAccount>
findByIsActiveAndClientNameIgnoreCaseContainingOrderByAccountCreatedDesc(
Boolean active, String clientNameSearchString);
}
AccountRepository.java
@Entity
@Table(name = "account")
public class Account implements Serializable {
@Entity(name="allAccounts")
@Table(name = "account")
public class AllAccount implements Serializable {
@RepositoryDefinition(domainClass = Account.class, idClass = Integer.class)
public interface AccountRepository extends CrudRepository<Account, Integer>
{
public List<AllAccount>
findByIsActiveAndClientNameIgnoreCaseContainingOrderByAccountCreatedDesc(
Boolean active, String clientNameSearchString);
}
@RepositoryDefinition(domainClass=Account.class,idClass=Integer.class)
公共接口AccountRepository扩展了Crudepository
{
公开名单
FindByisActiveAndClientNameIgnoreCaseingOrderByAccountCreatedEsc(
布尔活动,字符串clientNameSearchString);
}
当我从我的服务类调用上述存储库时,我发现异常。
我错在哪里?
多谢各位
public interface AccountRepository extends CrudRepository<Account, Integer>
它试图从类型Account
转换为AllAccount
,但它无法转换,因此出现异常
您可以为AllAccount
创建一个不同的存储库类,或者将此类更改为返回AllAccount
public interface AccountRepository extends CrudRepository<AllAccount, Integer>
公共接口AccountRepository扩展了Crudepository
它试图从类型Account
转换为AllAccount
,但它无法转换,因此出现异常
您可以为AllAccount
创建一个不同的存储库类,或者将此类更改为返回AllAccount
public interface AccountRepository extends CrudRepository<AllAccount, Integer>
公共接口AccountRepository扩展了Crudepository
您在AllAccount
课程中有什么?如果它只是一个帐户的列表
,那么您可以尝试从repository类返回帐户的列表
,而不是所有帐户
类中有什么?如果它只是帐户的列表
,那么您可以尝试从repository类返回帐户的列表
,而不是AllAccount
感谢您给予了宝贵的时间。上述解决方案对我有效。我创建了新的存储库类,而不是更改帐户。非常感谢。谢谢你给我宝贵的时间。上述解决方案对我有效。我创建了新的存储库类,而不是更改帐户。非常感谢。