I like this approach because it is simple and clean:
String getCompaniesIdAndName = " select "
+ " c.id as id, "
+ " c.name as name "
+ " from Company c ";
@Query(value = getCompaniesWithoutAccount)
Set<CompanyIdAndName> findAllIdAndName();
public static interface CompanyIdAndName extends DTO {
Integer getId();
String getName();
}