if (period.getStartDate().equals(startDate) && period.getEndDate().equals(endDate)
if (period.getStartDate().equals(start) && period.getEndDate().equals(end)
    public Object readByCalendarAndNextPeriod(Calendar startDate, Calendar endDate, Integer keyNextPeriod)            throws ExcepcaoPersistencia {        List<IPeriod> periods = (List<IPeriod>) readAll(Period.class);        for (IPeriod period : periods) {            if (keyNextPeriod == null) {                if (period.getStartDate().equals(startDate) && period.getEndDate().equals(endDate)) {                    return period;                }            } else {                if (period.getStartDate().equals(startDate) && period.getEndDate().equals(endDate)                        && period.getNextPeriod().getIdInternal().equals(keyNextPeriod)) {                    return period;                }            }        }        return null;        /*         * Criteria criteria = new Criteria(); criteria.addEqualTo("startDate",         * startDate); criteria.addEqualTo("endDate", endDate); if         * (keyNextPeriod != null) {         * criteria.addEqualTo("nextPeriod.idInternal", keyNextPeriod); } return         * queryObject(Period.class, criteria);         */    }