Hendrik Jungnitsch
2022-08-29 ffed6b90b963dd0a56ca359c94f62a2f97686271
src/main/java/de/gedoplan/seminar/jpa/exercise/rest/HighwayResource.java
@@ -38,7 +38,7 @@
  public void insert(@RequestBody Highway highway) {
    this.logger.debug("----- insert -----");
    
    // this.highwayRepository.
    this.highwayRepository.save(highway);
    this.logger.debug("Inserted: " + highway);
  }
@@ -49,7 +49,7 @@
  @GetMapping("/{ID}")
  public Highway findById(@PathVariable("ID") Integer id) {
    this.logger.debug("----- findById -----");
    Optional<Highway> highway = Optional.empty();//this.highwayRepository.
    Optional<Highway> highway = this.highwayRepository.findById(id);
    highway.ifPresent(h -> this.logger.debug(id+": "+h));
    return highway.orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_FOUND));