1. <small id='g90yJ'></small><noframes id='g90yJ'>

    <tfoot id='g90yJ'></tfoot>
    • <bdo id='g90yJ'></bdo><ul id='g90yJ'></ul>
  2. <i id='g90yJ'><tr id='g90yJ'><dt id='g90yJ'><q id='g90yJ'><span id='g90yJ'><b id='g90yJ'><form id='g90yJ'><ins id='g90yJ'></ins><ul id='g90yJ'></ul><sub id='g90yJ'></sub></form><legend id='g90yJ'></legend><bdo id='g90yJ'><pre id='g90yJ'><center id='g90yJ'></center></pre></bdo></b><th id='g90yJ'></th></span></q></dt></tr></i><div id='g90yJ'><tfoot id='g90yJ'></tfoot><dl id='g90yJ'><fieldset id='g90yJ'></fieldset></dl></div>
    <legend id='g90yJ'><style id='g90yJ'><dir id='g90yJ'><q id='g90yJ'></q></dir></style></legend>

      SpringData:查询注释中是否可以有子查询?

      时间:2024-08-24

      <legend id='jX5aB'><style id='jX5aB'><dir id='jX5aB'><q id='jX5aB'></q></dir></style></legend>

      1. <i id='jX5aB'><tr id='jX5aB'><dt id='jX5aB'><q id='jX5aB'><span id='jX5aB'><b id='jX5aB'><form id='jX5aB'><ins id='jX5aB'></ins><ul id='jX5aB'></ul><sub id='jX5aB'></sub></form><legend id='jX5aB'></legend><bdo id='jX5aB'><pre id='jX5aB'><center id='jX5aB'></center></pre></bdo></b><th id='jX5aB'></th></span></q></dt></tr></i><div id='jX5aB'><tfoot id='jX5aB'></tfoot><dl id='jX5aB'><fieldset id='jX5aB'></fieldset></dl></div>
        <tfoot id='jX5aB'></tfoot>

          <tbody id='jX5aB'></tbody>
          • <bdo id='jX5aB'></bdo><ul id='jX5aB'></ul>

              <small id='jX5aB'></small><noframes id='jX5aB'>

                本文介绍了SpringData:查询注释中是否可以有子查询?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我想知道是否可以在@Query 注释中包含子查询(org.springframework.data.jpa.repository.Query;)

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

                我在第一个子查询括号中收到 QuerySyntaxException.

                I am getting a QuerySyntaxException on the first subquery parentesis.

                这是我的查询

                @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")
                

                谢谢!

                推荐答案

                不,JPQL查询的select子句中不能有子查询.

                No, it is not possible to have subquery in the select clause in JPQL query.

                JPQL 支持 WHERE 和 HAVING 子句中的子查询.它可以(至少)是 ANY、SOME、ALL、IN、EXIST 表达式的一部分,当然也可以使用普通的条件表达式:

                JPQL supports subqueries in WHERE and HAVING clauses. It can be (at least) part of ANY, SOME, ALL, IN, EXIST expressions, and of course it can be used normal conditional expressions:

                SELECT a
                FROM A a
                WHERE a.val = (SELECT b.someval 
                               FROM B b 
                               WHERE b.someotherval=3)
                

                这篇关于SpringData:查询注释中是否可以有子查询?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:如何在没有@Id的情况下使用spring Repository? 下一篇:指定是否延迟加载 Spring Data

                相关文章

                <legend id='xoNhG'><style id='xoNhG'><dir id='xoNhG'><q id='xoNhG'></q></dir></style></legend>
              • <small id='xoNhG'></small><noframes id='xoNhG'>

                <i id='xoNhG'><tr id='xoNhG'><dt id='xoNhG'><q id='xoNhG'><span id='xoNhG'><b id='xoNhG'><form id='xoNhG'><ins id='xoNhG'></ins><ul id='xoNhG'></ul><sub id='xoNhG'></sub></form><legend id='xoNhG'></legend><bdo id='xoNhG'><pre id='xoNhG'><center id='xoNhG'></center></pre></bdo></b><th id='xoNhG'></th></span></q></dt></tr></i><div id='xoNhG'><tfoot id='xoNhG'></tfoot><dl id='xoNhG'><fieldset id='xoNhG'></fieldset></dl></div>
                <tfoot id='xoNhG'></tfoot>
                  • <bdo id='xoNhG'></bdo><ul id='xoNhG'></ul>