Hi,
The scenario is as follows
Company object which contains a List of Employees, and each Employee object has List of Address objects.
I have lazy loading enabled for all the collections since I dont want to load the entire object tree to be loaded all the time.
Now my concern is, when I need the collections including the nested one (i.e list of Address for each Employee) , how can I force this
I have used Hibernate.initialize(company.getEmployee()) to load the list of employee.But how can I apply this to the inner collection of Address , for each employee
what I have done is below
Code:
Hibernate.initialize(company.getEmployee())
Itarator<Employ> empItr=company.getEmployee();
Employ emp=null;
while(empItr.hasNext()){
Hibernate.initialize(emp.getAdresses());
}
But I dont tink this is the best way to do this.Can anybody suggest a better solution?
Shaiju
Scientia