title: Spring JPA. How to get only a list of IDs using @Query
body: <p>I am trying to write this to fetch List and i have to pass the list of Ids as parameter :</p>
  <pre><code>@Query(value = &quot;SELECT OutbreakDiagnosticTests FROM OutbreakDiagnosticTests WHERE OutbreakDiagnosticTests.outbreaks  in (:outbreakIds) &quot;)
  List&lt;OutbreakDiagnosticTests&gt; getDiagnosticTestsByOutbreaks(@Param(&quot;outbreakIds&quot;) List&lt;Long&gt; outbreakIds);
  </code></pre>
  <p>My Entity is this that i am using to query is this :</p>
  <pre><code>@Entity
  @EntityListeners(OutbreakDiagnosticTestManagerImpl.class)
  @Table(name = &quot;outbreak_diagnostic_tests&quot;)
  public class OutbreakDiagnosticTests extends AbstractTemporalWorkingData implements Serializable{
    
  /**
     * 
     */
    private static final long serialVersionUID = 636298998880960358L;
  
    @Id
    @Column(nullable = false, name = &quot;obdt_id&quot;)
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private long obdtId;
  
    @Column(nullable = false, name = &quot;nature&quot;, length = 255)
    private String nature;
  
    @Column(nullable = true, name = &quot;diagnostic_test_req&quot;, length = 255)
    private String diagnosticTestReq;
  
    @OneToMany(mappedBy = &quot;outbreakDiagnosticTests&quot;, cascade = CascadeType.ALL, orphanRemoval = true)
    @Filter(name = &quot;workingData&quot;)
    private Set&lt;TestsResults&gt; testsResults;
  
    @ManyToOne
    @JoinColumn(name = &quot;outbreak_id&quot;, nullable = false)
    private Outbreaks outbreaks;
  
    @ManyToOne
    @JoinColumn(name = &quot;diag_test_id&quot;, nullable = true)
    private DiagnosticTests diagTests;
  
    @ManyToOne
    @JoinColumn(name = &quot;lab_id&quot;, nullable = true)
    private Laboratories lab;
  
    @Column(nullable = false, name = &quot;is_field&quot;)
    private Boolean isField = false;
  </code></pre>
  <p>But i am getting this exception after running :</p>
  <pre><code>Error creating bean with name 'labTestSummariesDaoImpl': Unsatisfied dependency expressed through field 'obDiagTestRepository'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'outbreakDiagnosticTestRepository': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Validation failed for query for method public abstract java.util.List com.wahisplus.wcommon.repository.outbreak.OutbreakDiagnosticTestRepository.getDiagnosticTestsByOutbreaks(java.util.List)!
  </code></pre>
  <p>Can some one help me to fetch the List using the above method or can tell me what i am doing wrong in this.I dnt want to do using native i.e (nativeQuery = true) using this.</p>