@Query("select clusters.id, " +
"sum(greatest(frequencies.january, " +
"frequencies.february, " +
"frequencies.march, " +
"frequencies.april, " +
"frequencies.may, " +
"frequencies.june, " +
"frequencies.july, " +
"frequencies.august, " +
"frequencies.september, " +
"frequencies.october, " +
"frequencies.november, " +
"frequencies.december)) summedFrequency " +
"from ClusterEntity clusters " +
"left join PhraseEntity phrases on phrases.cluster.id=clusters.id " +
"left join FrequencyEntity frequencies on frequencies.phrase.id=phrases.id " +
"where clusters.page.id = :page_id " +
"group by clusters.id "
)
List<ClusterEntity> findAllClustersByPage(@Param("page_id") Integer pageId);
此方法肯定不会返回ClusterEntity的列表。
你能告诉我当我执行一些任意的查询时返回什么吗?
1条答案
按热度按时间jgwigjjp1#
是的,它肯定不会是
ClusterEntity
。我不知道你的ClusterEntity
的结构,但看起来你试图从你的表中检索多个列,根据你的@Query
语句。如果这是真的,那么默认情况下,它返回List<Object[]>
,并获得结果转换为一个特定的类型,你可以在这里找到更多的信息,如果没有,那么请更具体。How to get multiple columns from table using JPA?