Getting Started with Spring Data JPA
Learn how to use Spring Data JPA to store and retrieve data from your database.
See Also - Marco Codes
In addition to this tutorial, we recommend you check out Marco Codes - JDBC Tutorial - Crash Course to learn about:
- How to use JDBC, i.e. the basic API that every Java program uses to access databases
- Understand what JDBC drivers are and where to get them
- How to use an embedded H2 database, in addition to the usual suspects like MySQL or Postgres
- Fire off SQL select, insert, update and delete statements from Java
- Connection pools and the overall Java database framework/library landscape
![Introduction](/guide/assets/thumbnail-e539f26e.png)
Introduction
Getting started with Spring Data JPA.
![Creating a New Spring Boot Project](/guide/assets/thumbnail-0169ad34.png)
Creating a New Spring Boot Project
Use the Spring Initializr to create a new Spring Boot project.
![Creating an Employee Entity](/guide/assets/thumbnail-e539f26e.png)
Creating an Employee Entity
Create a JPA entity representing an Employee.
![Creating a Repository Interface](/guide/assets/thumbnail-df97d8e8.png)
Creating a Repository Interface
Create a Spring Data repository for CRUD operations.
![Configuring your Database](/guide/assets/thumbnail-0e802085.png)
Configuring your Database
Configure the application to connect to our database.
![Writing from your Application to the Database](/guide/assets/thumbnail-487e48ff.png)
Writing from your Application to the Database
Insert four employees into the database.
![Creating a Data Source](/guide/assets/thumbnail-86e6046f.png)
Creating a Data Source
In the Database View, create a data source for our database.
![Calling a Custom Query](/guide/assets/thumbnail-d05c5483.png)
Calling a Custom Query
Query the database for employees with spaces in their last name.
![Summary](/guide/assets/thumbnail-d3dd5aeb.png)
Summary
Shortcuts, GitHub repository and other resources