How to override findAll() for Spring JPA?

104 Views Asked by At

I need to use a @Query annotation for findAll() method in my repository, which extends JpaRepository.

But I am getting the following error: "Not annotated method overrides method annotated with @NonNullApi"

Here is my repository:

@Repository
public interface CommandInputRepo extends JpaRepository<CommandInput, Long> {

    @Query("SELECT DISTINCT columnA FROM tableA")
    List<Object> findAll();

After googling on StackOverFlow I have tried to create a package-info.java class, in which I defined 2 annotations: @NonNullApi and @NonNullFields.

package-info.java

@NonNullApi
@NonNullFields
package com.server.robot;

import org.springframework.lang.NonNullApi;
import org.springframework.lang.NonNullFields;

But the error doesn't disappear.

Do you know what else should I define or change?

0

There are 0 best solutions below