Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 558 Vote(s) - 3.45 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Difference between spring-data-jpa and spring-boot-starter-data-jpa

#1
This may not be the best question to ask, but I noticed there are 2 Spring JPA for Spring boot. How are they different? Currently, I am trying to set up a Spring Boot 1.5.3 project along with Hibernate. I remember I had set up Spring Boot with JPA earlier with spring-boot-starter-data-jpa.

Most of the online examples I have seen as well as starter.spring.io provide the below dependency for Spring JPA.

<!-- language: xml -->

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>

But in one of the existing projects I came across spring-data-jpa:

<!-- language: xml -->

<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
<version>1.11.4.RELEASE</version>
</dependency>

Doing a bit of Google did not give me if they are different or not.

In all my previous projects where I added JPA was though JPA 2.1/Hibernate that is why I am a bit unsure which of the 2 to use in my new Spring Boot application.
Reply

#2
Check the pom.xml for spring-boot-starter-data-jpa here:

[To see links please register here]


Read the description tag which says: "Starter for using Spring Data JPA with Hibernate".

So spring-boot-starter-data-jpa uses Spring Data JPA with Hibernate as the implementation. This is hard-coded, so to speak.


If you now check the pom.xml for spring-data-jpa, it is implementation-agnostic. And to use Spring Data JPA in any project, one **must** provide the implementation to use. Not doing that will give you an error.

Spring Data JPA documentation states that it currently supports Hibernate 5, (Apache) OpenJPA 2.4 and EclipseLink 2.6.1. Read here:

[To see links please register here]

Reply

#3
As stated in the [docs][1], the `starter` one is a convenient inliner for all required dependencies for this particular library, i.e. includes other dependencies in itself, instead of you writing those manually.

Look into the `spring-boot-starter-data-jpa` [pom.xml][2], you will see there it includes `spring-data-jpa` as a dependency among many others.

> Spring Boot Starters are a set of convenient dependency descriptors
> that you can include in your application. You get a one-stop-shop for
> all the Spring and related technology that you need without having to
> hunt through sample code and copy paste loads of dependency
> descriptors. For example, if you want to get started using Spring and
> JPA for database access just include the spring-boot-starter-data-jpa
> dependency in your project, and you are good to go.


[1]:

[To see links please register here]

[2]:

[To see links please register here]

Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through