In this post, I will detail how Spring Framework handles transactions behind the scenes

Image by spring.io

Before we talk about how the framework handles transactions, we need to understand some basic concepts that will be essential for understanding content throughout this post.

The first concept: The isolation of the ACID.

“If you do not know what the ACID (atomicity, consistency, isolation, durability) means, I recommend looking for associated materials because in this post I will not go into depth about this content.”

At this point, we will talk briefly about the isolation of the ACID, more specifically about read phenomena and isolation levels.

When working with concurrent transactions in a database, we need to understand what levels of isolation DBMS offer and what type…


Find out how to escape some traps when using JPA

Introduction

I would like to bring you 3 quick tips that will help you to escape hidden traps when you are creating or maintaining JPA applications.

To be brief, let’s get straight to the point.

1 - Using the @Transactional annotation unnecessarily

Analyzing the method below, everything seems to be right.

  • An entity is retrieved from the database;
  • A field is changed in this entity;
  • If the verification is true, the entity is updated in the database.
public void verifyAndUpdateUniverse(Integer univeserId, UniverseDto universeDto) {    Universe universe = universeRepository.getOne(univeserId);
universe.setUniverseName(universeDto.getUniverseName());
if (!universeDto.getUniverseName().equals("Invalid Universe")) {
universeRepository.save(universe);
}
}

But what happens if I add the @Transactional annotation to this method?


Today I am here to introduce a true anti-hero when using JPA in Java applications, I am talking about Eager, one of the strategies for loading data from the database, when there are relationships between tables.

Before starting, I will make a brief explanation of the difference between EAGER and LAZY loading, the two strategies for the relationship between entities when using the Java Persistence API.

LAZY: In lazy loading, we load data related to the main object, only when we need it. For example, if object A contains an attribute of type B, when we perform a query on…


In this post, I would like to talk about some recent updates on the Java platform that can help you optimize your application’s startup time and improve the memory footprint.

Nowadays, due to architectural changes, with containerized environments and serverless applications, it is increasingly important to be concerned with the startup time and resource consumption of your application, something that was not a major concern until a few years ago.

First of all, I would like to make it clear that this post aims to help achieve these optimizations with native JVM resources. I know that there are other strategies…


Today I would like to share with you an interesting way to provide some business indicators in your Java application, in a simple way, without the need to expose data through an analytical environment or perform queries in your application’s database and take the risk to degrade the performance with poorly performed queries.

But what is Azure Application Insights?

In a nutshell, Application Insights is a managed service from Azure that allows you to monitor your applications in a simple way, helping you understand your customers’ behavior, evaluate performance and diagnose possible problems.

More information about Application Insights at: https://docs.microsoft.com/en-us/azure/azure-monitor/app/app-insights-overview


Um pouco sobre a arquitetura do Docker, passando rapidamente por cada um de seus componentes.

A maioria das pessoas que escutam falar de Docker pela primeira vez, acabam fazendo uma analogia com o conceito de máquinas virtuais, apesar de ser muito parecido para quem olha de fora, por baixo dos panos a coisa é bem diferente.

Diferente de máquinas virtuais onde você precisa subir todo um sistema operacional, o Docker utiliza recursos do Kernel do Linux como namespaces, cgroups e chroot para isolamento dos processos em execução, com isso temos ganhos muito grandes no tempo de provisionamento das instâncias e economia de recursos do host.

Arquitetura Docker

A arquitetura do Docker é composta pelos seguintes componentes:

Client…

Thiago Mendes

Software Engineer (mail.thiagomendes@gmail.com)

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store