title: Spring JPA Data "OR" query
body: <p>I am using Spring Data JPA and trying to add a query to my repository.  I was trying to just build the query without the @Query annotation like:</p>
  
  <pre><code>List&lt;Item&gt; findByTypeAndStateOrStateAndStartDateBetween(Type type, State s, State s2, Date startDate, Date endDate);
  </code></pre>
  
  <p>My goal is to build a query like so:</p>
  
  <pre><code>select * from item where type = ? and (state = ? or state = ?) and start_date between ? and ?
  </code></pre>
  
  <p>My problem is with the OR clause.  Is there a way to make sure there are brackets?  Otherwise, the logic isn't right.  The examples I found here:
  <a href="http://static.springsource.org/spring-data/data-jpa/docs/1.0.0.M1/reference/html/#jpa.query-methods.query-creation">http://static.springsource.org/spring-data/data-jpa/docs/1.0.0.M1/reference/html/#jpa.query-methods.query-creation</a></p>
  
  <p>don't have any or clauses with more than 1 column.</p>
  
  <p>Also, is there a way to pass in a List of objects.  For instance, if I wanted to find items with 3 states I would have to create another query, which doesn't scale very well.</p>
  
  <p>Thanks.</p>
  
  <p>EDIT:</p>
  
  <p>I figured out how to pass of list of states using the @Query notation.  You do it like so:</p>
  
  <pre><code>@Query("FROM item i WHERE i.type = ?1 AND i.state IN (?2)")
  </code></pre>
  
  <p>Then you can just pass in a list to the method as the second parameter.  Still don't know how to do this without using the @Query notation.</p>