ItEr36S07ValidacionEProbasFuncionaisItEr35S08: [Bug #100] Avoiding LazyInitializationException ensuring that the AggregatedHours' properties being shown are already loaded.

This commit is contained in:
Óscar González Fernández 2009-11-25 19:46:17 +01:00
parent ea9b5b8cbe
commit c99c0b0aca

View file

@ -265,8 +265,22 @@ public class ResourceAllocationModel implements IResourceAllocationModel {
}
@Override
@Transactional(readOnly = true)
public List<AggregatedHoursGroup> getHoursAggregatedByCriterions() {
return task.getAggregatedByCriterions();
TaskSource taskSource = task.getTaskSource();
taskSourceDAO.reattach(taskSource);
List<AggregatedHoursGroup> result = taskSource
.getAggregatedByCriterions();
ensuringAccesedPropertiesAreLoaded(result);
return result;
}
private void ensuringAccesedPropertiesAreLoaded(
List<AggregatedHoursGroup> result) {
for (AggregatedHoursGroup each : result) {
each.getCriterionsJoinedByComma();
each.getHours();
}
}
@Override