title: Spring JPA - Find By EmbeddedId partially
body: <p>Below code is for demo purpose only.</p>
  
  <p>My <em>Entity</em> bean looks like this</p>
  
  <pre><code>@Entity
  class Employee {
  
      @EmbeddedId
      private EmployeeKey employeeKey;
  
      private String firstName;
      private String lastName;
  
      // Other fields
      // Getter and Setters
  }
  </code></pre>
  
  <p>The <em>Embeddable</em> class:</p>
  
  <pre><code>@Embeddable
  class EmployeeKey implements Serializable {
  
      private int employeeId;
      private String branchName;
      private String departmentName;
  
      //Getter and Setters
  }
  </code></pre>
  
  <hr>
  
  <p>I can write <em>JPARepository</em> interface method to find Employees by the EmbeddedId that returns me results as well.</p>
  
  <pre><code>interface EmployeeRepository extends JpaRepository&lt;Employee, EmployeeKey&gt; {
          List&lt;Employee&gt; findByEmployeeKey(EmployeeKey employeeKey);
  }
  </code></pre>
  
  <hr>
  
  <p><strong>Question:</strong>
  Suppose, while querying I have <em>employeeId</em> and <em>branchName</em> only, and I don't want to put filter on <em>departmentName</em> </p>
  
  <ul>
  <li>In such cases how can I write my Repository method</li>
  <li>Does JPA have something in-build for such scenario?</li>
  </ul>