Unfortunately, I am unable to deal with the error. I have 2 id's of which the "mieszkanie" is owned by the "deweloper". Would anyone be able to help?
@DeleteMapping("/{deweloperId}/mieszkanie/{mId}")
public ResponseEntity deleteMieszkanie(@PathVariable Long mId, @PathVariable Long deweloperId) {
List<Mieszkanie> allMieszkania = mieszkanieRepository.findMieszkanieByDeweloperId(deweloperId);
List<MieszkanieDto> result = allMieszkania.stream()
.map(this::convertToDto)
.collect(Collectors.toList());
deweloperRepository.deleteById(mId);
return new ResponseEntity(HttpStatus.NO_CONTENT);
}
CodePudding user response:
What are you trying to do? If you have a field "DeweloperId" in Mieszkanie entity you only need delete Deweloper entity.
CodePudding user response:
two questions:
- provide an error message and/or stacktrace
- provide entities between which you have an association.