3 Database access with Spring Data
This chapter covers:
- Introduction to Spring Data, its needs, and various Spring Data Modules
- Configuring a relational database, NoSQL database (MongoDB), and access data in a Spring Boot Application
- Enabling Spring Data JPA to manage business domain objects with relational database
- Various techniques to access data from a relational database using @NamedQuery, @Query, Criteria API and Querydsl
You’ve already explored a variety of topics on Spring Boot in the last two chapters. With a solid overview of Spring Boot, you’ve learned a few common tasks that you may use in your Spring Boot quite frequently. Now, what’s next? In today’s world, most applications are just incomplete without a database that stores the application data. Spring Boot applications are no exception to it. In this chapter, you’ll boot your journey by interacting with the database from your Spring Boot application. You’ll explore how seamless it is to perform database configuration, initialization, access data, and manage business objects in the database with Spring Boot!
3.1 Introducing Spring Data
Spring Data (https://spring.io/projects/spring-data) lets you access data from a variety of data sources (e.g., relational and non-relational databases, map-reduce databases, and cloud-based data services). It attempts to provide a uniform, easy-to-use, and familiar programming model through the Spring Framework.