I am using the following repository and controller to retrieve some records from the DB:
public interface TableARepository extends CrudRepository<TableA, Long>{
@Query(value = "SELECT r FROM TableA r WHERE r.Id = :Id", nativeQuery = true)
public Rater getTableAById(@Param("Id") Long Id);
}
@RestController
public class TableAController {
@Autowired
TableARepository tableARepository;
@GetMapping(value="/GetTableAById")
public TableA getTableAById(@RequestParam String email) {
TableA tableA = new TableA();
tableA = tableARepository.getTableAById(email);
return tableA;
}
}
The following error appears once i invoke the REST api:
Cannot invoke com.TableARepository.getTableAById(Long) because this.tableARepository is null