1. Overview

Spring Data JPA is an implementation of Java Persistence API for data storage and retrieval and this article is about to provide a detailed explanation of spring data JPA with examples.

Spring Data JPA provides support for SQL and No-SQL databases. So in this tutorial, we will learn Spring JPA with SQL as well as No-SQL database. We are going to explain examples like,
how to create a dynamic query in JPA,
how to apply projection,
In and like query in spring data JPA.

NOTE: In this tutorial, all the example using spring boot and spring JPA but we can also use spring JPA without spring boot.

Spring data JPA supports SQL databases like, MySQL, PostgreSQL, Oracle, MSSQL etc. To configure SQL database we need to configure specific database driver.

Spring data JPA supports NoSQL databases like, MongoDBNeo4JElasticsearchSolrRedisGemfire, CassandraCouchbase and LDAP. If you are new to Spring data JPA then it is worth to read No-SQL support for spring JPA.

  • Without spring boot application: In order to implement spring JPA without spring boot application we need to add the dependency groupId: org.springframework.data and artifactId:spring-data-jpa in Maven or Gradle tools.
  • With spring boot application: For implementing spring JPA with spring boot application we need to add the dependency groupId:org.springframework.boot and artifactId: spring-boot-starter-data-jpa in Maven or Gradle tools. We have explained with details in our how to create JSON web service with Spring JPA article.

2. Spring JPA with SQL database

2.1 Database Migration

Database migration is not directly part of spring JPA but while working with the database, We always require to update the database schema so here we have explained some of the  SQL database migration tools like flyway and liquibase.

  1. Spring boot flyway example
  2. Spring boot liquibase example
  3. Flyway Repeatable Migration Example
  4. Spring boot Flyway Java Based Migration Example

3. Spring JPA with No-SQL database

3. Conclusion

This spring data JPA tutorial may help you learn Spring JPA with examples and it also provides better insight for Spring Data JPA.

4. References

 

 

Was this post helpful?

Leave a Reply

Your email address will not be published. Required fields are marked *