找不到能够从类型转换的转换器
No converter found capable of converting from type
我有这个class:
public class UsersXCountry {
Integer numUsers;
String countryCode;
}
和这个查询:
@Query(value = "select count('1'), country_code from t_user group by country_code",
nativeQuery = true)
List<UsersXCountry> usersXCountry();
但是我有这个错误
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)
除向 UsersXCountry
添加 getter、setter 外,名称必须相同
@Query(value = "select count('1') as numUsers, country_code as countryCode from t_user group by country_code",
nativeQuery = true)
List<UsersXCountry> usersXCountry();
我有这个class:
public class UsersXCountry {
Integer numUsers;
String countryCode;
}
和这个查询:
@Query(value = "select count('1'), country_code from t_user group by country_code",
nativeQuery = true)
List<UsersXCountry> usersXCountry();
但是我有这个错误
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)
除向 UsersXCountry
添加 getter、setter 外,名称必须相同@Query(value = "select count('1') as numUsers, country_code as countryCode from t_user group by country_code",
nativeQuery = true)
List<UsersXCountry> usersXCountry();