title: spring JPA query to find events by locationId and categoryId
body: <p>This is my events entity.</p>
  <pre><code>@Data
  @AllArgsConstructor
  @NoArgsConstructor
  @Entity
  public class Events {
  
      @Id
      @GeneratedValue(strategy = GenerationType.AUTO)
      private Long eventId;
  
  
      @NotBlank(message = &quot;Please Add Event name &quot;)
      @Length(max =100 ,min =2)
      private String eventName ;
  
  
  
      private String eventDescription;
  
      // Each event is going to be mapped to a Location
      @OneToOne(cascade = CascadeType.ALL)
      @JoinColumn(
              name = &quot;location_id&quot;,
              referencedColumnName = &quot;locationId&quot;
      )
      @NotNull
      private Location location ;
  
  
      @Temporal(TemporalType.DATE)
      Date eventStartDate;
  
      @Temporal(TemporalType.DATE)
      Date eventEndDate;
  
  
  
  
      @OneToOne(cascade = CascadeType.ALL)
      @JoinColumn(
              name = &quot;category_id&quot;,
              referencedColumnName = &quot;categoryId&quot;
      )
      @NotNull
      private Categories categories;
  
  
  }
  </code></pre>
  <p>In my controller ,i have access to locationId and categoryId as request params .
  I am not getting how to define my eventsRepository to access by locationId and categoryId. What changes should i make to this repo for things to work .</p>
  <pre><code>@Repository
  public interface EventsRepository extends JpaRepository&lt;Events,Long&gt; {
      public Events findByCateoryAndLocation()
  }
  </code></pre>