Transaction Savepoints in Spring JDBC

Savepoints allow you to create markers within a transaction that you can rollback to, without preventing the transaction from being committed at a later point. These can be treated like intermediate transactions within a single overarching transaction. At the end of the day, you either commit the transaction and persist all the changes to the database or rollback everything. Using savepoints, you can handle potential database errors and return to a safe point within the transaction and carry on.

This post will look at how you can use savepoints within Spring JDBC.

How to Connect a MySQL Database to a Vaadin Application (Part 1)

This tutorial focuses on how to wire your web application to a MySQL database so you can Create, Read, Update, and Delete (CRUD) information in a database via a Vaadin web application. The idea is to show you how to connect a template project downloaded from https://start.vaadin.com to a database so you can replicate it to your own needs. This is not about best practices (for Vaadin, Spring, or MySQL) but about helping you get started fast.

You can find the code used in this tutorial from GitHub.

Specify Named Parameters Using the NamedParameterJdbcTemplate

In this article, we will cover how to use NamedParameterJdbcTemplate in a Spring boot application connected to a Postgres Database at the backend. We will be inserting, updating, and deleting employees from Postgres DB using NamedParameterJdbcTemplate. Just to keep the design appropriate, I have separated the dao, service, and controller. Service is just a pass-through in this article.

Overview

NamedParameterJdbcTemplate is a template class that allows a basic set of JDBC operations. It has an underlying classic JdbcTemplate, which allows running native SQL queries with '?' placeholders in execution time for prepared statements. NamedParameterJdbcTemplate implements NamedParameterJdbcOperations interface and holds the reference of JdbcTemplate object in JdbcOperations interface.