"no converter found capable of converting from type to type" Code Answer

3

return abdeadlinetype from repository:

public interface abdeadlinetyperepository extends jparepository<abdeadlinetype, long> {
    list<abdeadlinetype> findallsummarizedby();
}

and then convert to deadlinetype. manually or use mapstruct.

or call constructor from @query annotation:

public interface deadlinetyperepository extends jparepository<abdeadlinetype, long> {

    @query("select new package.deadlinetype(a.id, a.code) from abdeadlinetype a ")
    list<deadlinetype> findallsummarizedby();
}

or use @projection:

@projection(name = "deadline", types = { abdeadlinetype.class })
public interface deadlinetype {

    @value("#{target.id}")
    string getid();

    @value("#{target.code}")
    string gettext();

}

update: spring can work without @projection annotation:

public interface deadlinetype {
    string getid();    
    string gettext();
}
By Ciprian Rarau on July 29 2022
Only authorized users can answer the Search term. Please sign in first, or register a free account.