Show Hibernate/JPA SQL Statements from Spring Boot 1. Overview Spring JDBC and JPA provide abstractions over native JDBC APIs allowing developers to do away with native SQL queries. However, often we need to see those auto-generated SQL queries and the order in which they were executed for debugging purposes. In… Continue Reading sql-logging-spring-boot

Spring Data JPA Batch Inserts 1. Overview Going out to the database is expensive. We may be able to improve performance and consistency by batching multiple inserts into one. In this tutorial, we’ll look at how to do this with Spring Data JPA. 2. Spring JPA Repository First, we’ll need… Continue Reading spring-data-jpa-batch-inserts

Quick Guide on Loading Initial Data with Spring Boot 1. Overview Spring Boot makes it really easy to manage our database changes in an easy way. If we leave the default configuration, it’ll search for entities in our packages and create the respective tables automatically. But sometimes we’ll need some… Continue Reading spring-boot-data-sql-and-schema-sql

A Guide to Spring AbstractRoutingDatasource Spring Persistence 1. Overview In this quick article, we’ll look at Spring’s AbstractRoutingDatasource as a way of dynamically determining the actual DataSource based on the current context. As a result, we’ll see that we can keep DataSource lookup logic out of the data access code.… Continue Reading spring-abstract-routing-data-source