Exemple #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("!!!!!");
  }
Exemple #2
0
  @Transactional(propagation = Propagation.REQUIRED, readOnly = true)
  public Hotel lazyLoad(Long id) throws Exception {

    Hotel hotel = hotelDAO.find(id);
    if (hotel != null) {
      if (hotel.getImages() != null) {
        hotel.getImages().size();
      }

      if (hotel.getResortTypes() != null) {
        hotel.getResortTypes().size();
      }
    }
    return hotel;
  }
Exemple #3
0
 @Transactional(propagation = Propagation.REQUIRED, readOnly = true)
 public List<Hotel> findByLocations(List<Location> llist) throws Exception {
   return hotelDAO.executeQueryByName("Hotel.findBylocation", new Object[] {llist});
 }