I have created a below java service to find an employee by it's Id for that I have created a employeeRepository
extends JPArepository
to findById
but here I want to call a stored procedure with in java service from SQL Server and pass the Employee id as parameter and to get the result to take it up further.
@GetMapping("/employees/{id}")
public ResponseEntity<Employee> getEmployeeById(@PathVariable(value = "id") Long employeeId)throws ResourceNotFoundException {
Employee employee = employeeRepository.findById(employeeId)
.orElseThrow(() -> new ResourceNotFoundException("Employee not found for this id :: " + employeeId));
return ResponseEntity.ok().body(employee);
}
Could anyone pleases guide how to call a stored procedure with in java service spring boot application