if (beginDate.getTime() != null) {
if (beginDate != null) {
    public void setBeginDate(Calendar beginDate) {        if (beginDate.getTime() != null) {            this.setBegin(beginDate.getTime());            } else {            this.setBegin(null);        }    }