We have web application designed using Spring + Hibernate. Following are the layers in our application.
JSP
|
Controllers
|
Facade
|
Service
|
DAO
While going through the code I saw some Service classes uses the other DAO classes. Is this the correct approach? I would like to know what is the correct way of using layers. Should facade layers directly use objects of service layers or they should go through the other facade object? Same with service layer?
Best approach for web application is
JSP
|
Controllers
|
Manager
|
Service
|
DAO
Where
JSP : View part
Controllers : Handling the incoming requests and returns the response and proper view definitions
Manager : This will be inject into Controllers, this is logical/functional unit. One manager can serve the multiple controllers
Service : This is service layer and will be invoked by Managers only, hence this will be inject into Managers class
DAO : Data access objects and this will inject into service layer
This is most common trends now a day all web application is following.