What is the difference between services, repositories and controller in JPA.
I know that repositories work with data abstraction. Who takes the data from the bank?
The mapped classes (@Entity), and the controller and the service?
What is the difference between services, repositories and controller in JPA.
I know that repositories work with data abstraction. Who takes the data from the bank?
The mapped classes (@Entity), and the controller and the service?
As already mentioned, JPA is just the database access technology. With it you can use Design Patterns that are not part of JPA specifically.
Repository is a Design Pattern where data is retrieved from the database and the business rule also occurs. This returns domain objects that would be Entities (classes annotated with @Entity).
DAO is another Design Pattern where there is only communication with the database without a business rule.
Service would be another Desing Pattern where there is only the business rule and does not have direct access to the database.
Controller It is used to handle View's connection with other parts of the system that are the business rule and database.
When developing a system you will choose which ones you will use. It can be Entity + DAO + Service, Entity + Repository, use an Object being Entity and Repository at the same time. Both cases connected with the view through the Controller.