Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/spring-boot/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java org.springframework.core.convert.ConverterNotFoundException:未找到能够从类型Account转换为类型AllAccount的转换器_Java_Spring Boot_Jpa - Fatal编程技术网

Java org.springframework.core.convert.ConverterNotFoundException:未找到能够从类型Account转换为类型AllAccount的转换器

Java 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

我使用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 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
感谢您给予了宝贵的时间。上述解决方案对我有效。我创建了新的存储库类,而不是更改帐户。非常感谢。谢谢你给我宝贵的时间。上述解决方案对我有效。我创建了新的存储库类,而不是更改帐户。非常感谢。