


Injection: Instance of SimpleJpaRepository (AccountRepository implementation) will be assigned to AccountRestController’s accountRepository (Of type AccountRepository) attribute while constructing AccountRestController class.Let’s check out the source code from my post in github(Checkout ‘data-jpa-begin’ branch) Configure Spring for JPA Add required dependencies From the developer's point of view, JPA is somewhere between ORM and the application layer and the abstract ORM responsibilities. It abstracts common patterns and define specifications so that ORM vendors such as Hibernate, EclipseLink or others will make use of it to provide their own concrete solutions.

This is one of the reasons for JPA existence. In the middle of project execution, If there is a need to switch to a different ORM tool, say Hibernate, then we have to learn Hibernate way of doing configurations which in turn end up with code refactoring. EclipseLink has its own set of methods, configuration, annotations, etc.

Then what is need of JPA? - For Example, EclipseLink is being used as an ORM tool for one of the project. In Reality, we can use ORM tools without the JPA specification. Hibernate, EclipseLink or other JAVA ORM tools are providing an ORM implementation. If JPA is a specification, who is providing implementation? ORM tools are providing implementation for JPA. Relationship between Java objects would be established by adding relational annotations (one-to-many, many-to-many, one-to-one, many-to-one). As a result, Java object mapped as relational database tables. The JPA provides a set of concepts in the form of interfaces & annotations to configure Java objects. JPA is a specification which means a set of guidelines to be followed to represent Java objects in databases.
