Use of PrevValue -java.lang.StackOverflowError

I am trying to validate user entered date in a composite entity. It works fine to through message but when i try to restore the previous date then getting exception. Here is the code that i have used in controller.

    public void init(Map<String, Object> params) {
        bankTranDetailDs.addItemPropertyChangeListener(e -> {
            if ("tranDate".equals(e.getProperty())) {
 if (e.getItem().getTranDate().before(dateFrom) || e.getItem().getTranDate().after(dateTo) ) {
                    e.getItem().setTranDate((Date) e.getPrevValue());
                    showNotification("Sorry, invalid date entered for the selected financial period", NotificationType.HUMANIZED);


	at ch.qos.logback.classic.Logger.trace(
	at com.haulmont.chile.core.model.impl.AbstractInstance.propertyChanged(

please check your conditions, your code causes change of the field “tranDate” again and again.

It seems that your previous value also is not suitable for your validation.