title: How to findBy Object argument in spring data?
body: <p>Instead of specifying the field of an object that I want to search by in spring data, I want it to search by all of the fields. E.g.:</p>
  
  <pre><code>@Entity
  @Table(name="FOO")
  public class Foo{
  private String firstName;
  private String lastName;
  private String middleName;
  private String ssn;}
  
  @Repository
  public interface FooDao extends CrudRepository&lt;Foo, Long&gt;{
  Foo findByFoo(Foo foo);}
  </code></pre>
  
  <p>Essentially what this does is look at the fields that are not null in a passed foo object and queries by them OR it queries all the fields the way they are, which can be null or not null.</p>
  
  <p>Assume that <code>Foo</code> has a lot of fields and trying to write individual queries wouldn't be very elegant.</p>
  
  <p>I also understand that I can dynamically do this myself, but I'd rather not do that if it's already possible.</p>