public static List<PernottamentoEntity> searchByCityDate(
      String city, String checkInDateStr, String checkOutDateStr) {

    List<PernottamentoEntity> pernottamentoList;
    java.util.Date checkInDate, checkOutDate;

    SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
    SimpleDateFormat sdfSQL = new SimpleDateFormat("yyyy/MM/dd");
    try {
      checkInDate = sdf.parse(checkInDateStr);
      checkInDateStr = sdfSQL.format(checkInDate);

      checkOutDate = sdf.parse(checkOutDateStr);
      checkOutDateStr = sdfSQL.format(checkOutDate);
    } catch (ParseException e) {
      e.printStackTrace();
    }

    String query =
        "where città like '"
            + city
            + "' AND "
            + "data_inizio < '"
            + checkOutDateStr
            + " 00:00:00' AND "
            + "data_finale > '"
            + checkInDateStr
            + " 00:00:00'";
    DAO dao = PernottamentoDaoHibernate.instance();
    DBManager.initHibernate();
    pernottamentoList = (List<PernottamentoEntity>) dao.getByCriteria(query);
    DBManager.shutdown();

    return pernottamentoList;
  }
  public static PernottamentoEntity getHotelById(String id) {

    List<PernottamentoEntity> pernottamentoList;

    String query = "where id =" + id + "'";
    DAO dao = PernottamentoDaoHibernate.instance();
    DBManager.initHibernate();
    pernottamentoList = (List<PernottamentoEntity>) dao.getByCriteria(query);
    DBManager.shutdown();

    return pernottamentoList.get(0);
  }
  public static List<PernottamentoEntity> searchByCity(String city) {

    List<PernottamentoEntity> pernottamentoList;

    String query = "where città like '" + city + "'";
    DAO dao = PernottamentoDaoHibernate.instance();
    DBManager.initHibernate();
    pernottamentoList = (List<PernottamentoEntity>) dao.getByCriteria(query);
    DBManager.shutdown();

    return pernottamentoList;
  }