java - Mixing DAO and service calls -


let's have layer above service layer, web controllers example. service layer in turn above dao/repo layer. in upper layer service calls used alongside repo calls. breaks layering of application extent, should bother wrapping repo methods findall() service methods. don't think so. there drawbacks might cause lot of pain because of such design? transactional issues?

i turn question around , - why not have service layer such method? such pain wrap dao method like:

 public class personservice {  ...      private persondao persondao;  ...      public list<person> findall() {          return persondao.findall();      }  ...  } 

client data if don't want send data entity represents person controller? map data in service layer object clients dependent on.

coupling coupling layers. controller layer should depend on service layer , service layer should depend on dao layer.

transactions transactions should handled @ service layer (as service method may call multiple dao methods).

business logic business logic should in service layer. therefore, should never bypass such logic calling dao directly.

i know, method findall, seems pointless think point layer coupling defeats argument.


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -