【发布时间】:2020-04-10 11:26:59
【问题描述】:
拥有此代码:
@Query(value = "SELECT t FROM trainings t ORDER BY RANDOM() LIMIT 8", nativeQuery = true)
List<Training> findRandom();
收到此错误:
org.postgresql.util.PSQLException: The column name id was not found in this ResultSet.
执行此代码时:
System.out.println(trainingRepo.findRandom());
我的问题在哪里?我该如何解决?
【问题讨论】:
-
你在 db lvl 上测试过这个查询吗?
-
不返回id字段?你为什么不直接做
select *?
标签: java spring postgresql spring-boot