title: How to replicate the Hibernate's @Where functionality in Spring JPARepository
body: <p>One of our entities is defined using the @Where annotation to handle "soft-deletes".</p>
  
  <pre><code>@Entity
  @Where(clause="user_type_cd != 'X'")
  public class User {
  ...
  </code></pre>
  
  <p>Now, we are realizing that at times, we still want to find such entities.  Unfortunately, the @Where annotation is working as designed and so the finders we have defined in JPARepository do not work to find deleted Users.</p>
  
  <p>For example,</p>
  
  <pre><code>@Repository("userRepo")
  public interface UserRepository extends JpaRepository&lt;User, Long&gt; {
      User findByLoginId(String login);
  }
  </code></pre>
  
  <p>If the user has been deleted, then the findByLoginIs() method will not return a user if user_type_cd equals to 'X'.  </p>
  
  <p>However, at times, we still want to find such a user, so I was thinking of moving the </p>
  
  <pre><code>@Where(clause="user_type_cd != 'X'")
  </code></pre>
  
  <p>annotation from the entity into the repository.  This way, I don't have to update all the methods in the repository and it would automatically add this criterium to all the finders.  Then, I can create another repository which will find ALL the Users without regard to soft deletes.</p>
  
  <p>However, I am not able to figure out the exact method that I can use to make all of the finders automatically append the </p>
  
  <pre><code>clause="user_type_cd != 'X'"
  </code></pre>
  
  <p>criteria to all methods of the repository without me having to explicitly write a custom @Query("... and user_type_cd != 'X'") for each finder method.</p>
  
  <p>So, in short, I am looking for all the auto-generated findBy and such methods to append the user_type_cd != 'X' to each find that is generated.</p>
  
  <p>Any ideas on how to accomplish this without resorting to custom @Query annotation?</p>