Fix bug LazyInitializationException on saving limiting resources

FEA: ItEr65OTS04CorreccionsRecursosLimitantes
This commit is contained in:
Diego Pino Garcia 2010-12-15 16:11:05 +01:00
parent 2f2ebb8f86
commit 3794fc60c6

View file

@ -24,6 +24,7 @@ import java.util.Date;
import java.util.List;
import org.hibernate.Criteria;
import org.hibernate.Hibernate;
import org.hibernate.criterion.Restrictions;
import org.joda.time.LocalDate;
import org.navalplanner.business.common.daos.GenericDAOHibernate;
@ -100,7 +101,10 @@ public class TaskElementDAO extends GenericDAOHibernate<TaskElement, Long>
}
private void updateSumOfAllocatedHoursToParent(TaskGroup taskGroup, Integer differenceOfHours) {
if(taskGroup != null) {
if (taskGroup != null) {
if (!Hibernate.isInitialized(taskGroup)) {
reattach(taskGroup);
}
taskGroup.addSumOfHoursAllocated(differenceOfHours);
updateSumOfAllocatedHoursToParent(taskGroup.getParent(), differenceOfHours);
}