Managing Transactions with Spring and Spring Data JPA

Managing Transactions with Spring and Spring Data JPA

Spring Boot and Spring Data JPA make the handling of transactions extremely simple. They enable you to declare your preferred transaction handling and provide seamless integration with Hibernate and JPA. The only thing you need to do is to annotate one of your methods with @Transactional. But what does that actually do? Which method(s) should…

LazyInitializationException – What it is and the best way to fix it
|

LazyInitializationException – What it is and the best way to fix it

The LazyInitializationException is one of the most common exceptions when working with Hibernate. There are a few easy ways to fix it. But unfortunately, you can also find lots of bad advice online. The proclaimed fixes often replace the exception with a hidden problem that will cause trouble in production. Some of them introduce performance…

Scope + Communication – The magic formula of microservices

Scope + Communication – The magic formula of microservices

For quite some time, finding the right scope of a microservice was proclaimed to solve all problems. If you do it right, implementing your service is supposed to be easy, your services are independent of each other, and you don’t need to worry about any communication between your services. Unfortunately, reality didn’t hold up to…

Distributed Transactions – Don’t use them for Microservices

Distributed Transactions – Don’t use them for Microservices

Since I started talking about microservices and the challenges that you have to solve whenever you want to exchange data between your services, I hear 3 things: You only need to model the scope of your services “the right way” to avoid these problems. We use multiple local transactions, and everything works fine. It’s really…