ItEr50S04ValidacionEProbasFuncionaisItEr49S04: Fixing problem adding and removing order elements without modify them.

This commit is contained in:
Manuel Rego Casasnovas 2010-03-09 12:23:11 +01:00 committed by Javier Moran Rua
parent 1de44e376a
commit 8e18dfeb70

View file

@ -364,6 +364,9 @@ public class OrderElementDAO extends GenericDAOHibernate<OrderElement, Long>
}
private boolean isAlreadyInUse(OrderElement orderElement) {
if (orderElement.isNewObject()) {
return false;
}
boolean usedInWorkReports = !getSession().createCriteria(
WorkReport.class).add(
Restrictions.eq("orderElement", orderElement)).list().isEmpty();