Bulk Update Using Spring JPA CriteriaUpdate

Criteria Update The new feature bulk update operation in Criteria API was added in JPA 2.1. I will show you an example how to perform bulk update using Spring JPA CriteriaUpdate. The CriteriaUpdate interface can be used to implement bulk update operations. Update operations performed through CriteriaUpdate interface are directly mapped to database update operations. Hence the persistent context is…

How To Log Online User Activity In Spring Boot Applications

Introduction Here I am going to build a system to log online user activity in Spring Boot applications using HandlerInterceptor interface. As an application owner you may want to track your user activities, such as, which page they are accessing, from where requests were made to your application, from which pages to which pages they are moving, etc. If your…

Spring Data JPA @NamedQuery and @NamedQueries Example

Introduction Spring Data JPA provides multiple ways of selecting or fetching data from database server and one of the ways is using @NamedQuery or @NamedQueries. @NamedQuery and @NamedQueries can be created using XML configuration, external properties file or using Java based annotation config. Spring Data JPA supports both JPQL and SQL native named queries. Here I am going to show…

GraphQL Spring MySQL CRUD Example

Introduction The tutorial, GraphQL Spring MySQL CRUD example will show you how to build CRUD (Create, Read, Update, Delete) operations using GraphQL with Spring Boot framework. We will use MySQL database server for storing data and Spring Data JPA to perform database activities. My previous tutorials on GraphQL explained about how to wrap REST APIs instead of converting them into…

Spring Data JPA IN Clause Example With WHERE Condition

Introduction In this example you will see how to work with IN clause with WHERE condition in SQL statement in Spring Data JPA. I will use MySQL server for this example. I will fetch selected rows or multiple rows selection as well as I will delete selected rows or multiple rows deletion from the table using IN operator with WHERE…

Work With IN, OUT And INOUT Parameters In Stored Procedures Using Spring Data JPA

IN, OUT, INOUT Params In this tutorial I will show you how to work with IN, OUT and INOUT parameters in Stored Procedure using Spring Data JPA. I will also call a stored procedure having no parameter at all. I am going to use MySQL server, so there may be some limitations on MySQL server or there may be some…

How to map Custom Query Results into DTO in Spring Data JPA

Introduction In this tutorial I will show you how to map custom query results into DTO in Spring Data JPA. Situations may occur while you are unable to return the entity object(s) as results from your Spring Data JPA Repository and instead you need to write custom query or native query for your business requirements. So in such situations you…

Spring Boot jQuery AJAX CRUD Example

Introduction In this example I will show you an example on Spring Boot jQuery AJAX CRUD. CRUD is an acronym for four operations such as Create, Read, Update and Delete. I am going to perform CRUD operations on company details. I will use here MySQL database to store company details information. I will perform each operation asynchronously through AJAX technique…

Spring Boot Data JPA Left, Right, Inner and Cross Join Examples on Three Tables

Introduction In this guide we will walk through Spring Boot Data JPA left, right, inner and cross join examples on three tables. In pas we have seen similar example on two tables but I got some requests on how to perform similar joins on three tables. Therefore I am going to show you how to perform joins – left, right,…

Spring Boot Data JPA CRUD Example

Spring Data JPA CRUD You will see here Spring Boot Data JPA CRUD example. CRUD is an acronym that means Create Read Update and Delete operations. I will use an in-memory h2 database in order to perform CRUD operations in database. I have other example on Spring Data JPA CRUD example but the application does not use Spring Boot. In…