The Spring Framework consists of a collection of projects, and one of these projects is Spring Data.
If you are using the Spring Framework for your application, you will most likely want to use Spring Data JPA together with Hibernate.
swaraj gupta wrote:1. Is there any such thing exists, which is called 'Spring JPA'? or it is that some people used to abbreviate 'Spring Data JPA' as 'Spring JPA' only?
swaraj gupta wrote:
Can we say that:
2.1 'Spring Data' project of Spring is totally an independent project of Spring, and has nothing to do with JPA specification?
2.2 'Spring Data' is not an API specification?
2.3 'Spring Data' alone could be used for dao operations as we use Hibernate.
swaraj gupta wrote:
3.1 Does that mean 'Spring Data JPA' is a specification or api like JPA that we are using it together with Hibernate which is a JPA implementation?
3.2 In case if 'Spring Data JPA' is a specification or api like JPA then why 'Spring Data JPA' api is written when JPA specification was already in place?
Often the most important part of the news is what they didn't tell.
swaraj gupta wrote:Thank you Jasper and Tim for your replies and clearing up a lot of my confusion around JPA and its implementations.
I just tried to summarize the discussion here with the help of following points. kindly correct me if anything which I have stated here is not correct.
1. Java Application(Non Spring Application) + Hibernate: It's a tightly coupled Java application with Hibernate. And, in case tomorrow if it would be required to change the JPA implementation then we may need to make the changes in our java application code as well.
Tim Holloway wrote:
2. Java Application(Non Spring Application) + JPA(using JPA jar) + Hibernate: Here, ideally we should be using the method signatures provided by the JPA in our Java application. However, at runtime the JPA implementation provided by Hibernate will be used. And in case if it would be required to change the JPA implementation i.e. Hibernate then it will be required to change the Hibernate jars with some other JPA implementation jars only.
Tim Holloway wrote:
3. Spring Application(without JPA jar) + Hibernate: It's a tightly coupled Spring application with Hibernate and changing the JPA implementation may not be the matter of changing the jars only. It may be required to change the application code as well.
Tim Holloway wrote:
4. Spring Application + JPA(using JPA jar)+ Hibernate: Here, we should be using the method signatures provided by JPA. However, at runtime the JPA implementation provided by Hibernate will be used. But in case if it would be required to change the JPA implementation, then it will be required to change the hibernate jars with some other JPA implementation jars only.
Tim Holloway wrote:
5. Spring Application + Spring Data JPA(using spring-data-jpa jar): This combination can be used but will fail at runtime due to the absence of concrete JPA implementation in our classpath and hence can not be used to access the relational database.
Tim Holloway wrote:
6. Spring Application + Spring Data JPA(using spring-data-jpa jar) + Hibernate: Spring Data JPA is another layer of abstraction or wrapper on top of JPA with some additional interfaces which further reduces our coding efforts required to access any relational database. But under the hood Spring Data JPA uses the core interfaces of JPA having their implementation provided by any of its implementation like Hibernate, Toplink, EclipseLink etc.
permaculture is a more symbiotic relationship with nature so I can be even lazier. Read tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
|