Beispiel #1
0
  @ExceptionHandler(Exception.class)
  @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
  public void saveImage(Hotel hotel, String fileName, InputStream inputStream) throws Exception {
    String dirPath = Config.HOTELS_FILES_DIR + hotel.getId();

    String filepath = FileDataStore.saveFile(dirPath, fileName, inputStream);

    hotel.getImages().add(new Image(filepath));
    hotelDAO.merge(hotel); // Обновитть теперь

    // System.out.println(">>>>@@@@");
    // throw new Exception("!!!!!");
  }