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
- It will also grant you the ability to provide extra functionality to
the methods provided by your
- Having your service layer will allow you to query your
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 is here to represent all the database operations that your DB is available to perform.