Session session = null;
try {
session = openSession();
Query q = session.createQuery(sql);
QueryPos qPos = QueryPos.getInstance(q);
if (createDate != null) {
qPos.add(CalendarUtil.getTimestamp(createDate));
}
if (status != null) {
qPos.add(status);
}
qPos.add(expirationWarningSent);
count = (Long)q.uniqueResult();
}
catch (Exception e) {
throw processException(e);
}
finally {