Slow performance with NamedParameterJdbcTemplate

Today I tried inserting 256 rows in a single, empty PostgreSQL table which has only one index on it using Spring's NamedParameterJdbcTemplate . To my surprise the single transaction took over 3 minutes to complete, over 500ms per INSERT statement. To make things worse, the same inserts during integration testing on an H2 database completed … Continue reading Slow performance with NamedParameterJdbcTemplate

Log contextual information to all log messages in Spring Boot using Logback’s MDC

Logging is sometimes one of the things on which too little attention is spent, but when production errors start to arrive you'll sure want to have the maximum amount of information you want. Most logging implementations in Java will give you the time, the name of the class (or to be more precise, the name … Continue reading Log contextual information to all log messages in Spring Boot using Logback’s MDC

Using alternative credentials for Liquibase in Spring Boot

One of the projects I'm working uses Spring Boot to handle all database changes for each micro-service. One of the obvious requirements to make this work is a database user with DBA rights, otherwise it can not create, alter or drop tables. You could configure the default datasource to use such user, but this would … Continue reading Using alternative credentials for Liquibase in Spring Boot

maven-jaxb2-plugin: java.lang.NoSuchFieldError: encoding

This is the TLDR; version of this bug, so if the following solution doesn't work for you, you might want to read it all. When upgrading to a new version of Maven you might be faced with the following exception   The problem is caused by a more recent version of com.sun.xml.bind:jabx-xjc being used when … Continue reading maven-jaxb2-plugin: java.lang.NoSuchFieldError: encoding

No inserts using Hibernate and Spring

I was setting up a simple side-project with Spring, Spring Data and Hibernate. My repositories are generated using Spring Data's jpa:repositories to save on development time and the database schema is generated using Hibernate, based on my JPA and JSR-303 annotated entities. However, one of the issues I encountered was that my repositories did not insert anything in … Continue reading No inserts using Hibernate and Spring