code: public boolean isStatisticExistsForApplicationAndAccountAndDate(final Application application,
  							final Account account, final Date date) {
  		final Calendar dateAsCal = new GregorianCalendar();
  		dateAsCal.setTime(date);
  		final int year = dateAsCal.get(Calendar.YEAR);
  		// +1 because in calendar Junary is 0, not 1
  		final int month = dateAsCal.get(Calendar.MONTH) + 1;
  		final int day = dateAsCal.get(Calendar.DAY_OF_MONTH);
  		
  		final StringBuilder hql = new StringBuilder(200);
  		hql.append("select stats from Statistic as stats ");
  		hql.append(" where stats.id.App.id = :app_id and ");
  		hql.append("       stats.id.Acc.id = :acc_id and ");
  		hql.append("       year(stats.id.Month) = :year and");
  		hql.append("       month(stats.id.Month) = :month and");
  		hql.append("       day(stats.id.Month) = :day");
  		
  		final Query query = getCurrentSession().createQuery(hql.toString());
  		query.setInteger("app_id", application.getId());
  		query.setInteger("acc_id", account.getId());
  		query.setInteger("year", year);
  		query.setInteger("month", month);
  		query.setInteger("day", day);
  		return query.uniqueResult() != null;
  	}
docs: /* (non-Javadoc)
  @see org.esupportail.smsuapi.dao.DaoService#isStatisticExistsForApplicationAndAccountAndDate
  (org.esupportail.smsuapi.dao.beans.Application, org.esupportail.smsuapi.dao.beans.Account, java.util.Date)