Spring Data JPA – Adding a Method in All Repositories 1. Overview Spring Data makes the process of working with entities a lot easier by merely defining repository interfaces. These come with a set of pre-defined methods and allow the possibility of adding custom methods in each interface. However, if… Continue Reading spring-data-jpa-method-in-all-repositories

REST Query Language with Spring Data JPA Specifications 1. Overview In this tutorial – we will build a Search/Filter REST API using Spring Data JPA and Specifications. We started looking at a query language in the first article of this series – with a JPA Criteria based solution. So –… Continue Reading rest-api-search-language-spring-data-specifications

Introduction to Spring Data JPA 1. Overview This article will focus on introducing Spring Data JPA into a Spring project and fully configuring the persistence layer. For a step by step introduction about setting up the Spring context using Java based configuration and the basic Maven pom for the project,… Continue Reading the-persistence-layer-with-spring-data-jpa

CrudRepository, JpaRepository, and PagingAndSortingRepository in Spring Data 1. Overview In this quick article, we’ll focus on different kinds of Spring Data repository interfaces and their functionality. We’ll touch on: CrudRepository PagingAndSortingRepository JpaRepository Simply put, every repository in Spring Data extends the generic Repository interface, but beyond that, they do each… Continue Reading spring-data-repositories

A Guide to SqlResultSetMapping 1. Introduction In this guide, we’ll take a look at SqlResultSetMapping, out of the Java Persistence API (JPA). The core functionality here involves mapping result sets from database SQL statements into Java objects. 2. Setup Before we look at its usage, let’s do some setup. 2.1. Maven Dependency… Continue Reading jpa-sql-resultset-mapping

@JoinColumn Annotation Explained 1. Introduction The annotation javax.persistence.JoinColumn marks a column for as a join column for an entity association or an element collection. In this quick tutorial, we’ll show some examples of basic @JoinCloumn usage. 2. @OneToOne Mapping Example The @JoinColumn annotation combined with a @OneToOne mapping indicates that a given column… Continue Reading jpa-join-column