Entity Graphs for Lazy Loading

May 16, 2018

*Entity Graphs* are templates for persistence query. One common problem it solves is *Lazy Loading*. This article introduces the basics of *Entity Graphs* and how to use *Entity Graphs* with *JPA* and *Spring Data* to solve the *Lazy Loading*.... Read more

Add Model Attributes to Layout Template

May 11, 2018

`@ControllerAdvice` is widely used to create exception handlers in a cross-cutting way when writing a Spring MVC or REST application. It could also be used to solve adding model attributes to any groups of controllers so that the model could be share... Read more

Spring @Transactional - Propagation Type

May 08, 2018

Spring `@Transactional` annotation is concise and powerful. To understand what's the best property setting for your use case in this annotation could be confusing if you don't clearly understand what transaction management key concepts are. In this s... Read more

Spring @Transactional - Isolation Level

May 04, 2018

Spring `@Transactional` annotation is concise and powerful. To understand what's the best property setting for your use case in this annotation could be confusing if you don't clearly understand what transaction management key concepts are. In this s... Read more

Entity Mapping with Inheritance in Hibernate

May 02, 2018

Inheritance could be enabled in Hibernate with the `@MappedSuperclass` annotation. This annotation could greatly reduce the boilerplate in our entity mapping.... Read more

Dependency Injection and Inversion of Control

Apr 29, 2018

We often mix the Dependency Injection (DI) with the Inversion of Control (IoC). In fact, DI is one form of IoC. This article clarifies the terms. ... Read more

Spring Data Substitutes ObjectMapper

Apr 27, 2018

Most of the times when we need a DTO mapping from our persistent entity, we would think of using an ObjectMapper. However, with the help of the Spring Data, you might not need an ObjectMapper. This lesson presents a solution to use Spring Data to rep... Read more

PostgreSQL and Hibernate CLOB

Apr 26, 2018

When you need a SQL data type that can hold more than 255 characters, you are likely to use some large character data type such as CLOB, BLOB. It is easy to find the right type if you know what exactly the database you will stick to. However, when we... Read more

Java Servlet CORS Filter with Preflight Options

Apr 26, 2018

A CORS filter determines what types of access control header will be set for the server response to the client's request. However, when the resource being accessed is behind a security layer, in order to send the payload to the security filters, an ... Read more