相关文章推荐
开心的保温杯  ·  升级 Linksys E8450 的 ...·  11 月前    · 
失恋的柿子  ·  美股财报季期间,投资者将关注AI给哪些公司带 ...·  1 年前    · 
追风的机器猫  ·  解决python中的TypeError: ...·  1 年前    · 
力能扛鼎的饭卡  ·  Skywell/开沃汽车 D07系列 ...·  2 年前    · 
宽容的领带  ·  CardView轻松实现圆角卡片效果_mat ...·  2 年前    · 
Code  ›  Hello friends may anybody help me about custom Query using J kotlinlang #spring
https://slack-chats.kotlinlang.org/t/479750/hello-friends-may-anybody-help-me-about-custom-query-using-j
大鼻子的枕头
1 年前
https://kotlinlang.org logo
Join Slack
Powered by
Hello friends, may anybody help me about custom Qu...
# spring
o

Okan Yıldırım

05/17/2022, 10:50 AM
Hello friends, may anybody help me about custom Query using JpaRepository ? I do use this query:
Copy code
@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<?, ?>]

Okan Yıldırım

05/17/2022, 10:51 AM
Also tried
List<Tuple>
, still did not work

Okan Yıldırım

05/17/2022, 10:52 AM
But the return type is like Pair this is example return [ [ 0, “ x@gmail.com ” ], [ 1, “ a@mail.com ” ] ]
g

Gabriel Pomin

05/17/2022, 11:32 AM
Have you tried
List<User>
?
o

Okan Yıldırım

05/17/2022, 3:29 PM
let me do it

Okan Yıldırım

05/17/2022, 3:30 PM
but I am not selecting all required fields of user

Okan Yıldırım

05/17/2022, 3:31 PM
Yeah it gave error
g

Gabriel Pomin

05/17/2022, 3:42 PM
Have you tried something like this, using some list implementation:
fun 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
 
推荐文章
开心的保温杯  ·  升级 Linksys E8450 的 OpenWRT 系统到 UBI - 杰哥的{运维,编程,调板子}小笔记
11 月前
失恋的柿子  ·  美股财报季期间,投资者将关注AI给哪些公司带来了实际的收益_手机新浪网
1 年前
追风的机器猫  ·  解决python中的TypeError: embedding(): argument ‘indices‘ (position 2) must be Tensor, not list_typeerror
1 年前
力能扛鼎的饭卡  ·  Skywell/开沃汽车 D07系列 【报价 价格 评测 怎么样】 -什么值得买
2 年前
宽容的领带  ·  CardView轻松实现圆角卡片效果_materialcardview 圆角_老胡杨的博客-CSDN博客
2 年前
今天看啥   ·   Py中国   ·   codingpro   ·   小百科   ·   link之家   ·   卧龙AI搜索
删除内容请联系邮箱 2879853325@qq.com
Code - 代码工具平台
© 2024 ~ 沪ICP备11025650号