1. 程式人生 > >JPA寫原生查詢的時候似乎需要返回全部欄位

JPA寫原生查詢的時候似乎需要返回全部欄位

@Transactional
    @Query(value="select *,(ABS(angle_1-?1)+ABS(angle_2-?2)+ABS(angle_3-?3)) as matching from side_statistic_result HAVING matching is not null ORDER by matching asc limit 1", nativeQuery=true)
    SideStatisticResult findMatchingResult(double angle1, double angle2, double angle3);

上面可以,但是*和matching換一個位置後會報找不到欄位的錯誤