Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
Ask Question
org.springframework.core.convert.ConverterNotFoundException: No
converter found capable of converting from type
[com.xxx.central.model.Account] to type
[com.xxx.central.model.AllAccount]
Below is my code
Account.java
@Entity
@Table(name = "account")
public class Account implements Serializable {
AllAccount.java
@Entity(name="allAccounts")
@Table(name = "account")
public class AllAccount implements Serializable {
AccountRepository.java
@RepositoryDefinition(domainClass = Account.class, idClass = Integer.class)
public interface AccountRepository extends CrudRepository<Account, Integer>
public List<AllAccount>
findByIsActiveAndClientNameIgnoreCaseContainingOrderByAccountCreatedDesc(
Boolean active, String clientNameSearchString);
When i am calling above repository from my service class i getting exception.
Where i am going wrong?
Thank you.
–
This line makes your Repository class only return types of object Account
.
That's why when you call
public List<AllAccount>
findByIsActiveAndClientNameIgnoreCaseContainingOrderByAccountCreatedDesc
it tries to covert from type Account
to AllAccount
which it can't and hence the exception.
Either you create a different repository class for AllAccount
or change this one to return AllAccount
by changing to
public interface AccountRepository extends CrudRepository<AllAccount, Integer>
–
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.