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

      • <bdo id='g8Pp0'></bdo><ul id='g8Pp0'></ul>

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

        <legend id='g8Pp0'><style id='g8Pp0'><dir id='g8Pp0'><q id='g8Pp0'></q></dir></style></legend>
        <tfoot id='g8Pp0'></tfoot>

        Spring data jpa - 如何通过方法名称组合多个And和Or

        Spring data jpa - How to combine multiple And and Or through method name(Spring data jpa - 如何通过方法名称组合多个And和Or)

        <tfoot id='S6Muy'></tfoot>

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

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

                  <tbody id='S6Muy'></tbody>
              • <legend id='S6Muy'><style id='S6Muy'><dir id='S6Muy'><q id='S6Muy'></q></dir></style></legend>
                • 本文介绍了Spring data jpa - 如何通过方法名称组合多个And和Or的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在尝试迁移应用程序.我正在从 Hibernate 到 Spring Data Jpa 工作.

                  I am trying to migrate the application. I am working on from Hibernate to Spring Data Jpa.

                  虽然 spring data jpa 提供了简单的查询构建方法,但我坚持创建同时使用 AndOr 运算符 的查询方法.

                  Though spring data jpa offers simple methods for query building, I am stuck up in creating query method that uses both And and Or operator.

                  方法名 - findByPlan_PlanTypeInAndSetupStepIsNullOrStepupStepIs(...)

                  当它转换成查询时,前两个表达式被组合起来,它执行为[(exp1 and exp2) or (exp3)].

                  When it converts into the query, the first two expressions are combined and it executes as [(exp1 and exp2) or (exp3)].

                  而需要的是](exp1) and (exp2 or exp3)].

                  谁能告诉我这是否可以通过 Spring data jpa 实现?

                  Can anyone please let me know if this is achievable through Spring data jpa?

                  推荐答案

                  同意 Oliver 的方法名称冗长且不可读,但是为了论证,您可以通过使用等效性来达到预期的结果

                  Agree with Oliver on long and unreadable method names, but nevertheless and for the sake of argument, you can achieve desired result by using the equivalency

                  A / (B / C) <=> (A / B) / (A / C)
                  A and (B or C) <=> (A and B) or (A and C)
                  

                  所以在你的情况下它应该看起来像这样:

                  So in your case it should look something like this:

                  findByPlan_PlanTypeInAndSetupStepIsNullOrPlan_PlanTypeInAndStepupStepIs(...)
                  

                  这篇关于Spring data jpa - 如何通过方法名称组合多个And和Or的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  How to send data to COM PORT using JAVA?(如何使用 JAVA 向 COM PORT 发送数据?)
                  How to make a report page direction to change to quot;rtlquot;?(如何使报表页面方向更改为“rtl?)
                  Use cyrillic .properties file in eclipse project(在 Eclipse 项目中使用西里尔文 .properties 文件)
                  Is there any way to detect an RTL language in Java?(有没有办法在 Java 中检测 RTL 语言?)
                  How to load resource bundle messages from DB in Java?(如何在 Java 中从 DB 加载资源包消息?)
                  How do I change the default locale settings in Java to make them consistent?(如何更改 Java 中的默认语言环境设置以使其保持一致?)
                    <bdo id='gwJ5A'></bdo><ul id='gwJ5A'></ul>
                    <tfoot id='gwJ5A'></tfoot><legend id='gwJ5A'><style id='gwJ5A'><dir id='gwJ5A'><q id='gwJ5A'></q></dir></style></legend>
                      1. <i id='gwJ5A'><tr id='gwJ5A'><dt id='gwJ5A'><q id='gwJ5A'><span id='gwJ5A'><b id='gwJ5A'><form id='gwJ5A'><ins id='gwJ5A'></ins><ul id='gwJ5A'></ul><sub id='gwJ5A'></sub></form><legend id='gwJ5A'></legend><bdo id='gwJ5A'><pre id='gwJ5A'><center id='gwJ5A'></center></pre></bdo></b><th id='gwJ5A'></th></span></q></dt></tr></i><div id='gwJ5A'><tfoot id='gwJ5A'></tfoot><dl id='gwJ5A'><fieldset id='gwJ5A'></fieldset></dl></div>
                          <tbody id='gwJ5A'></tbody>

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