The Spring Data findAll Anti-Pattern

Introduction In this article, we are going to see why inheriting the default Spring Data findAll method in every data access Repository is a terrible Anti-Pattern.

How to use different Java versions for main and test in Maven

Introduction In this article, we are going to see how we can use different Java versions for the main and test folders in Maven so that you can run tests on a newer version of Java.

The best way to map MonetaryAmount with JPA and Hibernate

Introduction In this article, we are going to see what is the best way to map the MonetaryAmount object from Java Money and the Currency API when using JPA and Hibernate. While the Java Money and Currency API define the specification, like the MonetaryAmount interface, the Moneta project provides a reference implementation for this API.

Java data access technology survey results

Introduction Java has tons of data access frameworks, and in this article, we are going to what Java database technology is preferred by developers and for what reasons. The number one reason why we have so many data access frameworks in Java is JDBC. JDBC was a remarkable achievement. Prior to JDBC, programming languages didn’t have a database communication abstraction that could allow one application to work with any relational database implementing the JDBC Driver specification. The fact that JDBC offered this unified abstraction allowed Java developers to create various data access… Read More

The best way to configure the Hibernate Dialect

Introduction In this article, I’m going to explain what is the best way to configure the Hibernate Dialect so that you get the most out of your database.

The best way to use the Hibernate TupleTransformer

Introduction In this article, I’m going to explain how the Hibernate TupleTransformer works and how to use it to replace the deprecated ResultTransformer.

Hibernate SQM – Semantic Query Model

Introduction In this article, I’m going to explain what is the Hibernate SQM or Semantic Query Model so that you have a better picture of how JPQL or Criteria API queries are executed by Hibernate.

Hibernate 6 and JPQL Window Functions

Introduction In this article, I’m going to show you how you can use Hibernate 6 to write JPQL queries that use SQL Window Functions. This feature has been added in Hibernate 6, which provides a new query parser called SQM (Semantic Query Model), which is more powerful than the previous Hibernate HQL query capabilities.

Java application performance tuning using Lightrun

Introduction In this article, I’m going to show you analyze a Java application using Lightrun so that you can discover various performance tuning improvements you could apply to your current Java application. In this previous article, I explained what Lightrun is and how you can use it to inject dynamic logs, capture runtime snapshots, or add dynamic metrics. In this article, I’m going to use Lightrun as an alternative to my JPA Association Fetching Validator.

JPA Association Fetching Validator

Introduction In this article, I’m going to show you how we can build a JPA Association Fetching Validator that asserts whether JPA and Hibernate associations are fetched using joins or secondary queries. While Hibernate does not provide built-in support for checking the entity association fetching behavior programmatically, the API is very flexible and allows us to customize it so that we can achieve this non-trivial requirement.