A (Definitive?) Guide on LazyInitializationException

Posts that have been written about Hibernate's LazyInitializationException could probably fill whole books. Yet, I believe each of them focuses on a particular aspect of it: some on a specific solution, some on how to solve it with Spring Boot, etc. I'd like this post to be the definitive guide on the subject, even though I'm pretty sure it won't. At least, I'll be able to point others to it.

The Root Cause

Whether you love or hate ORM frameworks in general, they are nonetheless pretty common in the Java ecosystem. JPA is the ORM standard and part of the Jakarta EE specifications. Hibernate is its most widespread implementation: for example, it's the default in Spring Boot.

Kicking Spring Native’s Tires

I've been playing with GraalVM Ahead-Of-Time compilation capability since I became aware of it. As a long-time Spring aficionado, I carefully monitored the efforts that the engineers at Tanzu have put into making Spring AOT-compatible. Recently, they announced the beta version of the integration. In this post, I want to check how easy it is to produce a (working!) Docker image from an existing Spring Boot application.

Introduction

GraalVM provides many different features. Among them, the component known as Substrate VM allows to AOT-compile regular bytecode to a native executable. The process "walks" the application starting from the main method at build time. Substrate VM leaves out the code that it doesn't follow out from the resulting binary.

Monitoring Across Frameworks

Gone are the times when developers' jobs ended with the release of the application. Nowadays, developers care more and more about the operational side of IT: perhaps they operate applications themselves, but more probably, their organization fosters increased collaboration between Dev and Ops.

I started to become interested in the Ops side of software when I was still a consultant. When Spring Boot released the Actuator, I became excited. Via its convention-other-configuration nature, it was possible to add monitoring endpoints with just an additional dependency.

Beyond “Hello World”: Zero-Downtime Deployments With Hazelcast on Kubernetes

Today, I'd like to offer an approach that will allow most organizations to proceed with zero-downtime deployments with help from the Hazelcast platform.

Applications Are Not Stateless!

A couple of years ago, I became interested in Continuous Deployment as the natural extension of my deep interest in Continuous Integration. Among the CD patterns, Blue-Green deployment was the first. Here's a sample architecture: Blue Green deployment The idea is that a router component directs the requests to one environment; by convention blue. This environment contains all the necessary components for the application to achieve its task. Meanwhile, Ops can deploy a new version of the application in the green environment. When all is ready, they can switch the router to direct all the requests to the new green environment.

Distribution of JVM Desktop Applications

The previous posts of this series focused on different frameworks to develop JVM-based applications.

Distributing applications on a couple of computers inside the same company is not an issue. A lot of products are available for automating the pushing of files onto computers. Issues might start to appear when you need to coordinate the deployment across different physical sites.

The State of JVM Desktop Frameworks: Jetpack Compose for Desktop

The previous posts of this series were dedicated to frameworks that adopted the same traditional Object-Oriented-Programming approach. Components were modeled as classes. This week's post is dedicated to Jet Compose for Desktop, the new kid on the block that offers a completely different approach.

  1. The state of JVM desktop frameworks: Introduction
  2. The state of JVM desktop frameworks: Swing
  3. The state of JVM desktop frameworks: SWT
  4. The state of JVM desktop frameworks: TornadoFX

Getting Your Feet Wet

Originally, Jetpack Compose was a framework for the Android runtime. Compose for Desktop is its port to the JVM.

The State of JVM Desktop Frameworks: TornadoFX

The two previous posts of this series were respectively dedicated to Swing and SWT. This post is dedicated to Tornado FX, which itself is built on JavaFX.

  1. The State of JVM Desktop Frameworks: Introduction
  2. The State of JVM Desktop Frameworks: Swing
  3. The State of JVM Desktop Frameworks: SWT

JavaFX

JavaFX started as a scripting language named JavaFX script. Sun Microsystems intended to use it to compete with Adobe Flex (now Apache Flex) and Microsoft Silverlight to a lesser extent.

The State of JVM Desktop Frameworks: SWT

This series is dedicated to the state of JVM desktop frameworks. After having had a look at Swing last week, this post focuses on the Standard Widget Toolkit.

  1. The State of JVM Desktop Frameworks: Introduction
  2. The State of JVM Desktop Frameworks: Swing

What Is SWT?

SWT originated with the Eclipse project as an IDE. The developers built a dedicated framework for Eclipse in which to build their graphic components. Swing and SWT have widely different designs. Swing implements the drawing of widgets in Java from scratch. SWT is a thin wrapper API that relies on native graphic objects. This has two main benefits:

The State of JVM Desktop Frameworks: Swing

In the first post of this series, we went through the rise and fall of some of the desktop frameworks, mainly Java ones. This post and the following will each focus on a single JVM framework. To compare between them, a baseline is in order. Thus, we will develop the same application using different frameworks. Will use the Kotlin language because some of the frameworks require Kotlin.

This post focuses on the Swing API.

Creating Self-Contained Executable JARs

When your application goes beyond a dozen of lines of code, you should probably split the code into multiple classes. At this point, the question is how to distribute them. In Java, the classical format is the Java ARchive, better known as the JAR. But real-world applications probably depend on other JARs.

This post aims to describe ways to create self-contained executable JARs, also known as uber-JARs or fat JARs.

Scala vs. Kotlin: Multiple Inheritance and the Diamond Problem

Inheritance is one of the basic tenets of Object-Oriented Programming, along with encapsulation and polymorphism. Alongside simple inheritance, there is multiple inheritance:

Multiple inheritance is a feature of some object-oriented computer programming languages in which an object or class can inherit characteristics and features from more than one parent object or parent class. It is distinct from single inheritance, where an object or class may only inherit from one particular object or class.
Wikipedia

C++ is famous for allowing multiple inheritance and describing the diamond problem. It states that there’s an issue when a child class inherits from multiple classes that have the same method.

Are You Guilty of Over-Engineering?

If you listen to other language communities, such as Python or Ruby, it seems Java developers have a strong tendency for over-engineering.

Perhaps they’re just jealous of our superior platform (wink), perhaps there is some very slight reason that they believe so. I believe so. And it’s quite interesting that I realized it by doing code review — while I may be guilty of over-engineering myself when writing code. But I’m working on it.