[Bug #1006] it catchs HibernateOptimisticLockingFailureException in validator method

of the CalendarExceptionType Entity.

It is caught in the validator. Otherwise it would be wraped by hibernate and would
bypass the automatic handling of OptimisttcLockingFailureExceptions

FEA: ItEr74S04BugFixing
This commit is contained in:
Susana Montes Pedreira 2011-05-10 19:31:49 +02:00 committed by Manuel Rego Casasnovas
parent 2a101847d4
commit 1344e362ef
2 changed files with 8 additions and 1 deletions

View file

@ -28,6 +28,7 @@ import java.util.EnumMap;
import org.apache.commons.lang.BooleanUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.Validate;
import org.hibernate.NonUniqueResultException;
import org.hibernate.validator.AssertTrue;
import org.hibernate.validator.NotNull;
import org.navalplanner.business.calendars.daos.ICalendarExceptionTypeDAO;
@ -36,6 +37,7 @@ import org.navalplanner.business.common.Registry;
import org.navalplanner.business.common.exceptions.InstanceNotFoundException;
import org.navalplanner.business.workingday.EffortDuration;
import org.navalplanner.business.workingday.EffortDuration.Granularity;
import org.springframework.orm.hibernate3.HibernateOptimisticLockingFailureException;
/**
* Type of an exception day.
@ -172,7 +174,12 @@ public class CalendarExceptionType extends IntegrationEntity {
return calendarExceptionType.getId().equals(getId());
} catch (InstanceNotFoundException e) {
return true;
} catch (NonUniqueResultException e) {
return false;
} catch (HibernateOptimisticLockingFailureException e) {
return true;
}
}
}

View file

@ -48,7 +48,7 @@ import org.zkoss.util.InvalidValueException;
*/
@Service
@Scope(BeanDefinition.SCOPE_PROTOTYPE)
@OnConcurrentModification(goToPage = "/exceptionDays/exceptionDays.zul")
@OnConcurrentModification(goToPage = "/excetiondays/exceptionDays.zul")
public class CalendarExceptionTypeModel extends IntegrationEntityModel
implements ICalendarExceptionTypeModel {