I'll explain it with an example. Assume, I've two tables:
Department(deptId, deptName)
Employee(empId, empName, deptId)
And a DAO for each of them. Employee has Many to One relationship to Department. In my domain model Employee refers Department object.
-
Now when I call finder on EmployeeDAO, should I make a call to DepartmentDAO from inside EmployeeDAO, to return a completely formed Employee Object(with Department). Below post suggests against it:
- I also wanted to add Lazy loading for the Department, in which case it would seem that Employee Object should have a reference to DepartmentDAO, to call it when Employee#getDepartment() method is called, or is there any other way to do it.
Note : Domain objects are just for the sake of discussion, so please don't suggest to remodel them.
Aucun commentaire:
Enregistrer un commentaire