Hi Experts,
I am working on an STRUTS based web application.
I have a doubt about the flow being followed in the project design to access the Data. The flow goes as below:
Action Class ==[calls]==> DAO ==[Access Database]
My question is, for every DAOs such as EmpDAO, SalaryDAO etc., There are methods pertaining to the DAOs. For instance, In EmpDAO, say I am having getEmployeeDetails() method and in SalaryDAO, I am having getSalaryDetails() method.
For all the methods implemented in a particular DAO, are specified in an INTERFACE and the same is implemented in the respective DAOs.
For instance, the getEmployeeDetails() is defined in an interface EmpInterface, which has the getEmployeeDetails() method declared in it and the interface is implemented in the EmpDAO. The same is repeated for each and every DAOs.
In the ACTION class, the code goes like this:
EmpInterface intEmp = new EmpDAO();
intEmp.getEmployeeDetails(
) ;
I would like to know, "Is there any advantage of having an interface which holds all the methods used in the DAO?"
Please advice.
Thanks & Regards,
Madhu Manikandan, R
Start Free Trial