title: SpringData JPA "AND" and "OR" query not working as expected
body: <p>Well keep it simple I want to build a query to make it equivalent to:</p>
  <pre class="lang-sql prettyprint-override"><code>select * from user where (name like ? or detail like ?) and age = ?
  </code></pre>
  <p>What I have tried so far:</p>
  <pre><code>Page&lt;Post&gt; findByNameOrDetailContainingAndAgeEquals(String query, int age, Pageable pageable);
  
  Page&lt;Post&gt; findByNameContainingOrDetailContainingAndAgeEquals(String query, String query, int age, Pageable pageable);
  </code></pre>
  <p>All of these approaches failed. It seems that Spring split the query very wrong.</p>
  <p>I have checked all the examples in <a href="https://github.com/spring-projects/spring-data-jpa/blob/main/src/test/java/org/springframework/data/jpa/repository/sample/UserRepository.java" rel="nofollow noreferrer">https://github.com/spring-projects/spring-data-jpa/blob/main/src/test/java/org/springframework/data/jpa/repository/sample/UserRepository.java</a>
  but all of those examples are pretty simple (most queries even with just one simple condition).</p>
  <p>All I have read this answer <a href="https://stackoverflow.com/a/35794304/1299675">How to combine multiple And and Or through method name</a> and I agree with it. BUT, I don't think my scenario is complicated as the OP's, as you can see. Just &quot;AND&quot; and &quot;OR&quot; query condition combined which is quite easy in a SQL way but I just want make it by a JPA way.</p>