Comments (4)
OK, so your services act as facade/adapter for repository.
from ppj_project.
Please provide more informations. Only thing i found is this difference in every pair of classes:
findByImage -> CommentRepository
getByImage -> CommentService
...
But this is based on Example: Lecture8_SpringDataJPAWithSpringBoot
from ppj_project.
Another way: Is AService needed when i have ARepository ? When i need to add some functionality, for example listing most upvoted or downvoted comments, should this functionality be implemented in CommentService or CommentRepository?
from ppj_project.
When i have Repository, i dont need Service, because Repository implements all functionality. To answer your second question, functionality will be implemented in CommentRepository.
But Service layer gives you additional level of abstraction over data access from Repository. Service is kind of API and should transform input or output data somehow, call Repository and return expected result. To answer your first question, i will give you some example. My Repositories not always accepts objects, sometimes they need only ID, or some column from object. Thanks to my Services, i can always call service.method and pass object. When ID, or some column is required, i will extract from object in Service, so i dont need to call like repository.method1(object), repository.method2(object.column2), repository.method3(object), but i can call service.method1(object), service.method2(object), service.method3(object). Also when return value need to be changed, i can also do it in Service.
from ppj_project.
Related Issues (3)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ppj_project.