SpringData : is it possible to have subqueries in the Query annotation?

前端 未结 3 1774
庸人自扰
庸人自扰 2020-12-06 11:48

I would like to know if it is possible to have subquery in a @Query annotation (org.springframework.data.jpa.repository.Query;)

I am getting a QuerySyntaxException o

3条回答
  •  误落风尘
    2020-12-06 12:19

    The content of the @Query annotation is more or less passed as is to the persistence provider by calling EntityManager.createQuery(…). So whatever is allowed in there can be used in @Query. AFAIK, JPQL (by the time of JPA 2.0) only supports subqueries for EXISTS and IN clauses.

提交回复
热议问题