-2

I feel like this is a dumb question but here it goes: If i'm consuming rest (getting data and transforming in POJO), does it sit in the DAO or Service layer? As for what i've researched I believe that it should be in Service Layer but i couldn't find a definitive answer or explanation.

Thanks!

0

you can use this post as reference.

basically what one should do is use the service layer to expose DAO functionality thus,

  • it won't expose your DAO layer to the front end of your application.
  • It will also grant you the ability to provide extra functionality to the methods provided by your DAO layer.
  • Having your service layer will allow you to query your DAO layer through the service layer, making it much more easier to interface with your application.

Basically, one should use the DAO to deal with all the database staff (CRUD) operations while the Service layer is used to communicate with the DAO, adapt the data returned by the DAO and handle it without exposing the DAO.

DAO is here to represent all the database operations that your DB is available to perform.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.