Trying to retrive values from database with @Query("From UshtaretEntity"); but i am getting an erorr the famous one NullPointerExceptions seems like EkipaRepository is throwing exception
@Repository
public interface EkipaRepository extends CrudRepository<EkipaEntity,Long> {
@Query("FROM UshtaretEntity ")
List<UshtaretEntity> getAll();
}
public class testMain {
@Autowired
private EkipaRepository ekipaRepository;
public testMain(){
}
public List<UshtaretEntity> getAllEkipet(){
return ekipaRepository.getAll(); // line 28
}
public static void main(String[] args) {
testMain t = new testMain();
List<UshtaretEntity> lista = t.getAllEkipet(); // line 35
System.out.println(lista);
System.out.println(lista.size());
}
} *Error
Exception in thread "main" java.lang.NullPointerException
at com.example.demo.testMain.getAllEkipet(testMain.java:28)
at com.example.demo.testMain.main(testMain.java:35)