title: How can I correctly implement a Spring Data JPA repository method retrieving all the objects related to a list of object? (not to a single one)
body: <p>I am working on a Spring Boot application using Spring Data JPA and I have the following problem.</p>
  <p>I have this <strong>EventLog</strong> entity class:</p>
  <pre><code>@Entity
  @Table(name = &quot;log&quot;)
  @Getter
  @Setter
  @NoArgsConstructor
  @AllArgsConstructor
  @JsonIgnoreProperties({&quot;hibernateLazyInitializer&quot;, &quot;handler&quot;})
  public class EventLog implements Serializable {
  
      @Id
      @Column(name = &quot;id&quot;)
      @GeneratedValue(strategy=GenerationType.IDENTITY)
      private int id;
  
      @ManyToOne
      @EqualsAndHashCode.Exclude          // Needed by Lombock in &quot;Many To One&quot; relathionship to avoid error
      @JoinColumn(name = &quot;source_user_fk&quot;, referencedColumnName = &quot;id&quot;)
      //@JsonManagedReference(value = &quot;sourceUser&quot;)
      private User sourceUser;
  
      @ManyToOne
      @EqualsAndHashCode.Exclude          // Needed by Lombock in &quot;Many To One&quot; relathionship to avoid error
      @JoinColumn(name = &quot;destination_user_fk&quot;, referencedColumnName = &quot;id&quot;)
      private User destinationUser;
  
      @ManyToOne
      @EqualsAndHashCode.Exclude          // Needed by Lombock in &quot;Many To One&quot; relathionship to avoid error
      @JoinColumn(name = &quot;source_wallet_fk&quot;, referencedColumnName = &quot;id&quot;)
      private Wallet sourceWallet;
  
      @ManyToOne
      @EqualsAndHashCode.Exclude          // Needed by Lombock in &quot;Many To One&quot; relathionship to avoid error
      @JoinColumn(name = &quot;destination_wallet_fk&quot;, referencedColumnName = &quot;id&quot;)
      private Wallet destinationWallet;
  
      @Column(name = &quot;notes&quot;)
      private String notes;
  
  
      @Column(name = &quot;timestamp&quot;)
      private LocalDateTime timestamp;
  
      @ManyToOne
      @EqualsAndHashCode.Exclude          // Needed by Lombock in &quot;Many To One&quot; relathionship to avoid error
      @JoinColumn(name = &quot;log_type_fk&quot;, referencedColumnName = &quot;id&quot;)
      //@Column(name = &quot;log_type_fk&quot;)
      private LogType logType;
  }
  </code></pre>
  <p>As you can see it contains this <strong>LogType</strong> field:</p>
  <pre><code>@ManyToOne
  @EqualsAndHashCode.Exclude          // Needed by Lombock in &quot;Many To One&quot; relathionship to avoid error
  @JoinColumn(name = &quot;log_type_fk&quot;, referencedColumnName = &quot;id&quot;)
  private LogType logType;
  </code></pre>
  <p>Then I created the following repository interface:</p>
  <pre><code>public interface LogRepository extends JpaRepository&lt;EventLog, Integer&gt;, JpaSpecificationExecutor {
  
      EventLog findById(String id);
  
      Page&lt;EventLog&gt; findByLogTypeAndTimestampBetween(LogType logType, LocalDateTime fromDate, LocalDateTime toDate, Pageable pageable);
  
      // HERE THE PROBLEM !!!
      Page&lt;EventLog&gt; findByLogTypesAndTimestampBetween(List&lt;LogType&gt; logTypesList, LocalDateTime fromDate, LocalDateTime toDate, Pageable pageable);
  
      
      Page&lt;EventLog&gt; findByTimestampBetween(LocalDateTime fromDate, LocalDateTime toDate, Pageable pageable);
  
  }
  </code></pre>
  <p>Into this repository I have this <strong>findByLogTypeAndTimestampBetween()</strong> method retrieving a <strong>Page</strong> specifying a single <strong>LogType</strong> object as query input parameter (basically it return all the logs related to a specific type of log). It works fine.</p>
  <p>Then I tried to create the following <strong>findByLogTypesAndTimestampBetween()</strong> method that take a lkist of <strong>LogType</strong> and have to return the logs related to all the log types in the list.</p>
  <p>The problem is that adding this second method, running my application I obtain the following error message in my stacktrace:</p>
  <pre><code>Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'logRepository' defined in com.easydefi.users.repository.LogRepository defined in @EnableJpaRepositories declared on JpaRepositoriesRegistrar.EnableJpaRepositoriesConfiguration: Invocation of init method failed; nested exception is org.springframework.data.repository.query.QueryCreationException: Could not create query for public abstract org.springframework.data.domain.Page com.easydefi.users.repository.LogRepository.findByLogTypesAndTimestampBetween(java.util.List,java.time.LocalDateTime,java.time.LocalDateTime,org.springframework.data.domain.Pageable)! Reason: Failed to create query for method public abstract org.springframework.data.domain.Page com.easydefi.users.repository.LogRepository.findByLogTypesAndTimestampBetween(java.util.List,java.time.LocalDateTime,java.time.LocalDateTime,org.springframework.data.domain.Pageable)! No property logTypes found for type EventLog! Did you mean 'logType'?; nested exception is java.lang.IllegalArgumentException: Failed to create query for method public abstract org.springframework.data.domain.Page com.easydefi.users.repository.LogRepository.findByLogTypesAndTimestampBetween(java.util.List,java.time.LocalDateTime,java.time.LocalDateTime,org.springframework.data.domain.Pageable)! No property logTypes found for type EventLog! Did you mean 'logType'?
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1804) ~[spring-beans-5.3.12.jar:5.3.12]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:620) ~[spring-beans-5.3.12.jar:5.3.12]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.12.jar:5.3.12]
      at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.12.jar:5.3.12]
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.12.jar:5.3.12]
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.12.jar:5.3.12]
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.12.jar:5.3.12]
      at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) ~[spring-beans-5.3.12.jar:5.3.12]
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1380) ~[spring-beans-5.3.12.jar:5.3.12]
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1300) ~[spring-beans-5.3.12.jar:5.3.12]
      at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:887) ~[spring-beans-5.3.12.jar:5.3.12]
      at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:791) ~[spring-beans-5.3.12.jar:5.3.12]
      ... 101 common frames omitted
  Caused by: org.springframework.data.repository.query.QueryCreationException: Could not create query for public abstract org.springframework.data.domain.Page com.easydefi.users.repository.LogRepository.findByLogTypesAndTimestampBetween(java.util.List,java.time.LocalDateTime,java.time.LocalDateTime,org.springframework.data.domain.Pageable)! Reason: Failed to create query for method public abstract org.springframework.data.domain.Page com.easydefi.users.repository.LogRepository.findByLogTypesAndTimestampBetween(java.util.List,java.time.LocalDateTime,java.time.LocalDateTime,org.springframework.data.domain.Pageable)! No property logTypes found for type EventLog! Did you mean 'logType'?; nested exception is java.lang.IllegalArgumentException: Failed to create query for method public abstract org.springframework.data.domain.Page com.easydefi.users.repository.LogRepository.findByLogTypesAndTimestampBetween(java.util.List,java.time.LocalDateTime,java.time.LocalDateTime,org.springframework.data.domain.Pageable)! No property logTypes found for type EventLog! Did you mean 'logType'?
      at org.springframework.data.repository.query.QueryCreationException.create(QueryCreationException.java:101) ~[spring-data-commons-2.5.6.jar:2.5.6]
      at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.lookupQuery(QueryExecutorMethodInterceptor.java:106) ~[spring-data-commons-2.5.6.jar:2.5.6]
      at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.lambda$mapMethodsToQuery$1(QueryExecutorMethodInterceptor.java:94) ~[spring-data-commons-2.5.6.jar:2.5.6]
      at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) ~[na:na]
      at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133) ~[na:na]
      at java.base/java.util.Collections$UnmodifiableCollection$1.forEachRemaining(Collections.java:1056) ~[na:na]
      at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801) ~[na:na]
      at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) ~[na:na]
      at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) ~[na:na]
      at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913) ~[na:na]
      at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[na:na]
      at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682) ~[na:na]
      at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.mapMethodsToQuery(QueryExecutorMethodInterceptor.java:96) ~[spring-data-commons-2.5.6.jar:2.5.6]
      at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.lambda$new$0(QueryExecutorMethodInterceptor.java:86) ~[spring-data-commons-2.5.6.jar:2.5.6]
      at java.base/java.util.Optional.map(Optional.java:260) ~[na:na]
      at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.&lt;init&gt;(QueryExecutorMethodInterceptor.java:86) ~[spring-data-commons-2.5.6.jar:2.5.6]
      at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:360) ~[spring-data-commons-2.5.6.jar:2.5.6]
      at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.lambda$afterPropertiesSet$5(RepositoryFactoryBeanSupport.java:323) ~[spring-data-commons-2.5.6.jar:2.5.6]
      at org.springframework.data.util.Lazy.getNullable(Lazy.java:230) ~[spring-data-commons-2.5.6.jar:2.5.6]
      at org.springframework.data.util.Lazy.get(Lazy.java:114) ~[spring-data-commons-2.5.6.jar:2.5.6]
      at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.afterPropertiesSet(RepositoryFactoryBeanSupport.java:329) ~[spring-data-commons-2.5.6.jar:2.5.6]
      at org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean.afterPropertiesSet(JpaRepositoryFactoryBean.java:144) ~[spring-data-jpa-2.5.6.jar:2.5.6]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1863) ~[spring-beans-5.3.12.jar:5.3.12]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1800) ~[spring-beans-5.3.12.jar:5.3.12]
      ... 112 common frames omitted
  Caused by: java.lang.IllegalArgumentException: Failed to create query for method public abstract org.springframework.data.domain.Page com.easydefi.users.repository.LogRepository.findByLogTypesAndTimestampBetween(java.util.List,java.time.LocalDateTime,java.time.LocalDateTime,org.springframework.data.domain.Pageable)! No property logTypes found for type EventLog! Did you mean 'logType'?
      at org.springframework.data.jpa.repository.query.PartTreeJpaQuery.&lt;init&gt;(PartTreeJpaQuery.java:96) ~[spring-data-jpa-2.5.6.jar:2.5.6]
      at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$CreateQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:113) ~[spring-data-jpa-2.5.6.jar:2.5.6]
      at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$CreateIfNotFoundQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:254) ~[spring-data-jpa-2.5.6.jar:2.5.6]
      at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$AbstractQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:87) ~[spring-data-jpa-2.5.6.jar:2.5.6]
      at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.lookupQuery(QueryExecutorMethodInterceptor.java:102) ~[spring-data-commons-2.5.6.jar:2.5.6]
      ... 134 common frames omitted
  Caused by: org.springframework.data.mapping.PropertyReferenceException: No property logTypes found for type EventLog! Did you mean 'logType'?
      at org.springframework.data.mapping.PropertyPath.&lt;init&gt;(PropertyPath.java:90) ~[spring-data-commons-2.5.6.jar:2.5.6]
      at org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:437) ~[spring-data-commons-2.5.6.jar:2.5.6]
      at org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:413) ~[spring-data-commons-2.5.6.jar:2.5.6]
      at org.springframework.data.mapping.PropertyPath.lambda$from$0(PropertyPath.java:366) ~[spring-data-commons-2.5.6.jar:2.5.6]
      at java.base/java.util.concurrent.ConcurrentMap.computeIfAbsent(ConcurrentMap.java:330) ~[na:na]
      at org.springframework.data.mapping.PropertyPath.from(PropertyPath.java:348) ~[spring-data-commons-2.5.6.jar:2.5.6]
      at org.springframework.data.mapping.PropertyPath.from(PropertyPath.java:331) ~[spring-data-commons-2.5.6.jar:2.5.6]
      at org.springframework.data.repository.query.parser.Part.&lt;init&gt;(Part.java:81) ~[spring-data-commons-2.5.6.jar:2.5.6]
      at org.springframework.data.repository.query.parser.PartTree$OrPart.lambda$new$0(PartTree.java:249) ~[spring-data-commons-2.5.6.jar:2.5.6]
      at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) ~[na:na]
      at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179) ~[na:na]
      at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948) ~[na:na]
      at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) ~[na:na]
      at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) ~[na:na]
      at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913) ~[na:na]
      at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[na:na]
      at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682) ~[na:na]
      at org.springframework.data.repository.query.parser.PartTree$OrPart.&lt;init&gt;(PartTree.java:250) ~[spring-data-commons-2.5.6.jar:2.5.6]
      at org.springframework.data.repository.query.parser.PartTree$Predicate.lambda$new$0(PartTree.java:383) ~[spring-data-commons-2.5.6.jar:2.5.6]
      at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) ~[na:na]
      at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179) ~[na:na]
      at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948) ~[na:na]
      at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) ~[na:na]
      at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) ~[na:na]
      at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913) ~[na:na]
      at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[na:na]
      at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682) ~[na:na]
      at org.springframework.data.repository.query.parser.PartTree$Predicate.&lt;init&gt;(PartTree.java:384) ~[spring-data-commons-2.5.6.jar:2.5.6]
      at org.springframework.data.repository.query.parser.PartTree.&lt;init&gt;(PartTree.java:95) ~[spring-data-commons-2.5.6.jar:2.5.6]
      at org.springframework.data.jpa.repository.query.PartTreeJpaQuery.&lt;init&gt;(PartTreeJpaQuery.java:89) ~[spring-data-jpa-2.5.6.jar:2.5.6]
      ... 138 common frames omitted
  </code></pre>
  <p>What is wrong? What am I missing? How can I correctly define a repository method retrieving all the <strong>EventLog</strong> objects related to all the object into the <strong>List logTypesList</strong> parameter?</p>