• <legend id='sgYce'><style id='sgYce'><dir id='sgYce'><q id='sgYce'></q></dir></style></legend>

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

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

        <tfoot id='sgYce'></tfoot>

        如何使用 Hibernate 为 Spring data JPA 的所有查找方法添加全局 where 子句?

        How to add global where clause for all find methods of Spring data JPA with Hibernate?(如何使用 Hibernate 为 Spring data JPA 的所有查找方法添加全局 where 子句?)

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

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

          <tbody id='x8ljt'></tbody>
              <bdo id='x8ljt'></bdo><ul id='x8ljt'></ul>

                <legend id='x8ljt'><style id='x8ljt'><dir id='x8ljt'><q id='x8ljt'></q></dir></style></legend><tfoot id='x8ljt'></tfoot>
                • 本文介绍了如何使用 Hibernate 为 Spring data JPA 的所有查找方法添加全局 where 子句?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我们正在开发使用带有休眠功能的 Spring data JPA 的 Web 应用程序.

                  We are working on web application using Spring data JPA with hibernate.

                  在应用程序中,每个实体都有一个compid字段.这意味着在每个 DB 调用(Spring Data 方法)中都必须使用 compid 检查.

                  In the application there is a field of compid in each entity. Which means in every DB call (Spring Data methods) will have to be checked with the compid.

                  我需要一种方法,即where compid = ?"检查是否为每个查找方法自动注入.这样我们就不必专门为 compid 检查而烦恼.

                  I need a way that, this "where compid = ?" check to be injected automatically for every find method. So that we won't have to specifically bother about compid checks.

                  这可以通过 Spring Data JPA 框架实现吗?

                  Is this possible to achieve from Spring Data JPA framework?

                  推荐答案

                  也许 Hibernate 的注解 @Where 会对你有所帮助.它将传递的条件添加到与实体相关的任何 JPA 查询中.例如

                  Maybe Hibernate‘s annotation @Where will help you. It adds the passed condition to any JPA queries related to the entity. For example

                  @Entity
                  @Where(clause = "isDeleted='false'")
                  public class Customer {
                      //...
                      @Column
                      private Boolean isDeleted;
                  }
                  

                  更多信息:1,2

                  这篇关于如何使用 Hibernate 为 Spring data JPA 的所有查找方法添加全局 where 子句?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  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='0Flgl'></bdo><ul id='0Flgl'></ul>

                    1. <legend id='0Flgl'><style id='0Flgl'><dir id='0Flgl'><q id='0Flgl'></q></dir></style></legend>

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

                            <small id='0Flgl'></small><noframes id='0Flgl'>

                          1. <tfoot id='0Flgl'></tfoot>