Posted in Spring Boot Spring JPA

Spring Boot Hikari Connection Pool Configurations

Hikari Connection Pool Here in this Spring Boot application example, I am going to show you how to use Hikari connection pool to use dedicated HikariDataSource instead of the use of database specific datasource. Hikari connection pool commonly known as HikariCP is extremely fast, light-weight, simple and production ready JDBC connection pool.

Continue Reading... Spring Boot Hikari Connection Pool Configurations
Posted in Spring Boot Spring JPA

Spring Boot Data JPA Entity DTO Mapping Using MapStruct

Introduction In this example I will show you how to convert entity class to DTO (Data Transfer Object) class and DTO class to entity class using MapStruct. So, MapStruct will map entity class to DTO class or vice versa. This example will test both from RESTful webservices and standalone main class. Spring Boot provides CommandLineRunner interface to run the project…

Continue Reading... Spring Boot Data JPA Entity DTO Mapping Using MapStruct
Posted in Database Spring Boot Spring JDBC

Connecting To Multiple Oracle Data Sources Using JDBC LDAP URLs

Table of Contents Introduction Why do you want to connect to multiple database Prerequisites Project Setup Application Properties DataSource Configurations DAO Class Source Code Introduction Here I am going to show you how to connect to Oracle data source using JDBC LDAP URL. I am going to create multiple data sources for connecting to multiple Oracle databases using Spring Boot…

Continue Reading... Connecting To Multiple Oracle Data Sources Using JDBC LDAP URLs
Posted in Spring Boot Spring REST Spring Security

Spring Security Pre-Authentication with Spring Data JPA

Introduction In this example I am going to show you Spring Security Pre-authentication hasrole with Spring Data JPA. In my another example I had shown the similar example on Spring Security Pre-Authentication with Spring JDBC Template. There are situations where you want to use Spring Security for authorization, but the user has already been reliably authenticated by some external system…

Continue Reading... Spring Security Pre-Authentication with Spring Data JPA
Posted in Spring Boot Spring JPA Spring REST

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…

Continue Reading... How To Log Online User Activity In Spring Boot Applications
Posted in Spring Boot Spring JPA

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…

Continue Reading... Spring Data JPA @NamedQuery and @NamedQueries Example
Posted in MySQL Spring JPA Spring REST

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…

Continue Reading... Spring Data JPA IN Clause Example With WHERE Condition
Posted in Spring Boot Spring JPA

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…

Continue Reading... How to map Custom Query Results into DTO in Spring Data JPA
Posted in Hibernate MySQL Spring Boot

Spring Boot MVC and Hibernate CRUD Example

Introduction In this tutorial we will create an example on Spring Boot MVC and Hibernate CRUD. CRUD is an acronym that means Create, Read, Update and Delete operations. In my other tutorial I had also created Spring Boot MVC and JDBC CRUD Example. We will build the tutorial example using both maven and gradle build tools. We will create the…

Continue Reading... Spring Boot MVC and Hibernate CRUD Example
Posted in Spring Boot Spring JDBC Spring MVC Spring Transaction

Spring Boot MVC and JDBC CRUD Example

Introduction In my other tutorial I had shown how to create an example on Spring MVC and JDBC CRUD example using annotations only, but here I am going to use Spring Boot framework. I did not update the other tutorial keeping in mind if someone still needs the example using Spring framework only. Here also I am going to show…

Continue Reading... Spring Boot MVC and JDBC CRUD Example