While calling the procedure, the API org.springframework.data.jpa.repository.query#extractOutputValue(StoredProcedureQuery storedProcedureQuery) is unable to render a value, in case the stored procedure doesnt set any value to the output variable. In such case a null pointer exceptions occurs.
JAVAs Collectors.toMap(...) API doesn't allow null, as a value in the Map. In this case however null value is set, in case the output variable is null.
Returning a Map<String, Optional<Object>> instead of just Map<String, Object> in case there are more than one output variable.