我想知道是否有可能有一個@Query註釋子查詢(org.springframework.data.jpa.repository.Query;)SpringData:有可能在查詢註釋中有子查詢嗎?
我得到第一個子查詢parentesis一個QuerySyntaxException。
這裏是我的查詢
@Query(value="select c1 from ComplaintModel c1, "
+ "(select c2.id, min(cb.termDate) minDate from ComplaintModel c2 "
+ "join c2.complaintBullets cb join cb.status s where s.code = ?1 "
+ "group by c2.id) tmp where c1.id = tmp.id order by tmp.minDate")
謝謝!
這不是關於Spring Data,我相信你也不能在JPQL中做到這一點。 – 2012-03-16 19:49:46