Okan Yıldırım
05/17/2022, 10:50 AM@Query("select id, email from User")
fun getAllIdsAndEmails(): List<Pair<Long, String>>
But sadly I get an error of
No converter found capable of converting from type [org.springframework.data.jpa.repository.query.AbstractJpaQuery$TupleConverter$TupleBackedMap] to type [kotlin.Pair<?, ?>]
List<Tuple>
, still did not workGabriel Pomin
05/17/2022, 11:32 AMList<User>
?Okan Yıldırım
05/17/2022, 3:29 PMGabriel Pomin
05/17/2022, 3:42 PMfun getAllIdsAndEmails(): List<Long, String>
?
Or, you could use something like they show here: https://faun.pub/select-specific-columns-from-a-database-table-using-spring-data-jpa-d4eb0a24a2c4
That it is similar to what I see in a Stack overflow thread
Thats looks like the right path I thinkOkan Yıldırım
05/17/2022, 5:32 PMPavel
05/17/2022, 7:07 PMPair
but you can try this interface:
interface UserData {
val id: Long
val email: String?
}
and then you will have fun getAllIdsAndEmails(): List<UserData>
Okan Yıldırım
05/17/2022, 9:37 PM