@Query(value = "SELECT DISTINCT vip, instance FROM REPORT", nativeQuery = true)
List<VipINFO> findAllVIPS ();
I have this method in repository class, I want to map this data to List.
public class VIPInfo
{
private String vip;
private String instance;
}
I am getting this error when calling findAllVIPS method.
No converter found capable of converting from type [org.springframework.data.jpa.repository.query.AbstractJpaQuery$TupleConverter$TupleBackedMap] to type [com.sap.ariba.security.emc.model.HanaVIPInfo]
You can’t rely on Spring Data JPA’s automatic mapping feature when using a native query
The easiest way to do it is using interface-based DTO.
If you still want to use class-based DTO then you must define and reference a
@NamedNativeQuerywith an@SqlResultSetMapping.Refer to this article