Java and Database Newsletter, Issue 6

Introduction Welcome to a new issue of the Java and Database newsletter in which we share articles, announcements, and StackOverflow answers that are very relevant to any developer who interacts with a database system from Java.

The best way to use the JPA SqlResultSetMapping

Introduction In this article, I’m going to explain how to use the JPA SqlResultSetMapping, as well as the EntityResult, ConstructorResult, and ColumnResult options.

N+1 query problem with JPA and Hibernate

Introduction In this article, I’m going to explain what the N+1 query problem is when using JPA and Hibernate and what’s the best way to fix it. The N+1 query problem is not specific to JPA and Hibernate, as you can face this issue even if you are using other data access technologies.

Java and Database Newsletter, Issue 5

Introduction Welcome to a new issue of the Java and Database newsletter in which we share articles, announcements, and StackOverflow answers that are very relevant to any developer who interacts with a database system from Java.

A beginner’s guide to JPA persistence.xml file

Introduction In this article, I’m going to explain what is the purpose of the JPA persistence.xml configuration file, and how you can set up a Java Persistence application using the available XML tags or attributes. While Spring applications can bootstrap without needing an XML JPA configuration file, it’s still important to understand the meaning of each configuration option since Spring also offers an alternative way when building a Java Persistence LocalContainerEntityManagerFactoryBean or the Hibernate-specific LocalSessionFactoryBean.

Multiline String literals with Java Text Blocks

Introduction In this article, show you how the new Java Text Blocks can help you increase the readability of JPQL, SQL queries, or JSON string values. Back in 2005, I was developing a .NET project and really liked the C# Verbatim String Literal feature since it allows you to write a multiline string value without having to concatenate each individual line. The Java 13 Text Blocks feature now offers the possibility of creating a multiline Java String values.