No converter found capable of converting from type

No converter found capable of converting from type

Questions : No converter found capable of converting from type

3422

I have this class:

public class UsersXCountry { Integer numUsers; String countryCode; } 

and this query:

@Query(value = "select count('1'), country_code from t_user group by country_code", nativeQuery = true) List<UsersXCountry> usersXCountry(); 

but I have this error

No converter found capable of converting from type [org.springframework.data.jpa.repository.query.AbstractJpaQuery$TupleConverter$TupleBackedMap] to type [com.losmundo.backend.domain.UsersXCountry] at org.springframework.core.convert.support.GenericConversionService.handleConverterNotFound(GenericConversionService.java:322) 

Total Answers 1
33

Answers 1 : of No converter found capable of converting from type

The names must be identicals beside in4codes_java adding getters, setters to UsersXCountry

@Query(value = "select count('1') as numUsers, country_code as countryCode from t_user group by country_code", nativeQuery = true) List<UsersXCountry> usersXCountry(); 

0