Jens Schauder

Jens Schauder

Spring Data team member | Brunswick, Germany

Blog posts by Jens Schauder

This is the Beginning of the End of the N+1 Problem: Introducing Single Query Loading.

Engineering | August 31, 2023 | ...

TL;DR:

Starting with Spring Data JDBC 3.2.0-M2, Spring Data JDBC supports Single Query Loading. Single Query Loading loads arbitrary aggregates with a single select statement.

To enable Single Query Loading you need to call setSingleQueryLoadingEnabled(true) on your RelationalMappingContext.

In 3.2.0-M2, this works only for simple aggregates, consisting of an aggregate root and a single collection of other entities. It is also limited to the findAll, findById, and findAllByIds methods in CrudRepository. Future versions will improve on that. A final limitation is that the database you use has to support analytic functions (AKA window functions). All the officially supported databases except…

Spring Data JDBC - How To Maintain Your Database Schema

Engineering | August 29, 2023 | ...

This is the fifth article of a series about how to tackle various challenges you might encounter when using Spring Data JDBC. The series consists of:

  1. Spring Data JDBC - How to use custom ID generation?

  2. Spring Data JDBC - How do I make bidirectional relationships?.

  3. Spring Data JDBC - How do I implement caching?

  4. Spring Data JDBC - How Can I Do a Partial Update of an Aggregate Root?

  5. Spring Data JDBC - How do I Generate the Schema for my Domain Model? (This article)

If you are new to Spring Data JDBC, you should start by reading its introduction and this article, which explains the relevance of aggregates in the context of Spring Data JDBC

How to integrate Hibernates Multitenant feature with Spring Data JPA in a Spring Boot application

Engineering | July 31, 2022 | ...

For quite some time now, Hibernate has offered a Multitenant feature. It integrates nicely with Spring, but there is not much information about how to actually set it up, so I thought an example or two or three could help.

There is already an excellent blog article, but it is a little dated and it covers a lot of specifics to the business problems the author tried to solve. This approach hides a little of the actual integration, which will be the focus of this article.

Do not worry about the code in this post. You can find links to the full code examples at the end of this blog post.

What Does…

Announcing ListCrudRepository & Friends for Spring Data 3.0

Engineering | February 22, 2022 | ...

The Spring Data CrudRepository has various methods that return multiple instances of the entity managed by the repository. It does so by using Iterable and not List, as one might expect. In many cases, that is of no consequence, since you typically want to iterate over the result anyway. However, you might occasionally prefer a List. In these cases, Iterable is annoying.

I will write more about why that choice was made in the first place and how you can deal with it as long as you are on Spring Data 2.x. However, let me get the good news out first:

Repositories returning Lists

Spring Data 3.0.0 now offers a ListCrudRepository in the latest snapshot releases, which returns a List where CrudRepository returns an Iterable

Spring Data JDBC - How Can I Do a Partial Update of an Aggregate Root?

Engineering | January 20, 2022 | ...

This is the fourth article of a series about how to tackle various challenges you might encounter when using Spring Data JDBC. The series consists of:

  1. Spring Data JDBC - How to Use Custom ID Generation.

  2. Spring Data JDBC - How Do I Make Bidirectional Relationships?

  3. Spring Data JDBC - How Do I Implement Caching?

  4. Spring Data JDBC - How Can I Do a Partial Update of an Aggregate Root? (this article)

  5. Spring Data JDBC - How do I Generate the Schema for my Domain Model?

If you are new to Spring Data JDBC, you should start by reading introduction and this article, which explains the relevance of aggregates in the context of Spring Data JDBC

Spring Data 2021.1.0 goes GA

Releases | November 12, 2021 | ...

On behalf of the team, I’m pleased to announce the availability of the Spring Data 2021.1.0.

These are the most important changes:

  • Upgrade to Querydsl 5.0
  • Support jMolecules' @Identity Annotation for Identifiers
  • Fluent Query API for Querydsl and Query-by-Example
  • Deprecated RxJava 2 Support
  • MongoDB @DocumentReference, schema derivation for encrypted fields, and MongoDB 5.0 Time Series support
  • Redis 6.2 support
  • Support for streaming large result sets in Spring Data JDBC, Projections, and SQL Builder refinements around conditions, JOINs, and SELECT projections
  • Support for Impersonation and support for Querydsl in Neo4j

Spring Data 2021.0.7 and 2020.0.15 released

Releases | November 12, 2021 | ...

On behalf of the team, I’m pleased to announce the availability of the Spring Data 2021.0.7 and 2020.0.15 service releases.

Both releases are built on top of Spring Framework 5.3.13. For your convenience, you can consume Spring Data 2021.0.7 and 2020.0.15 through the upcoming Spring Boot releases, 2.5.7 and 2.4.13, respectively.

2020.0.x reached its end of life and will no longer be part of regular OSS releases. If you are still on this version, please consider upgrading at your earliest convenience.

Both service releases ship with mostly bug fixes and dependency upgrades.

To round things off…

Spring Data JDBC - How do I implement caching?

Engineering | October 18, 2021 | ...

This is the third article of a series about how to tackle various challenges you might encounter when using Spring Data JDBC.

The series consists of

  1. Spring Data JDBC - How to use custom ID generation.

  2. Spring Data JDBC - How do I make bidirectional relationships?

  3. Spring Data JDBC - How do I implement caching? (this article).

  4. Spring Data JDBC - How Can I Do a Partial Update of an Aggregate Root?

  5. Spring Data JDBC - How do I Generate the Schema for my Domain Model?

If you are new to Spring Data JDBC, you should start by reading its introduction and this article, which explains the relevance of aggregates in the context of Spring Data JDBC

Spring Data JDBC - How do I make Bidirectional Relationships?

Engineering | September 22, 2021 | ...

This is the second article of a series about how to tackle various challenges you might encounter when using Spring Data JDBC. The series consists of

  1. Spring Data JDBC - How to use custom ID generation.

  2. Spring Data JDBC - How do I make bidirectional relationships? (this article).

  3. Spring Data JDBC - How do I implement caching?

  4. Spring Data JDBC - How Can I Do a Partial Update of an Aggregate Root?

  5. Spring Data JDBC - How do I Generate the Schema for my Domain Model?

If you are new to Spring Data JDBC, you should start by reading its introduction and this article, which explains the relevance of aggregates in the context of Spring Data JDBC

Spring Data JDBC - How to use custom ID generation

Engineering | September 09, 2021 | ...

This is the first article of a series about how to tackle various challenges you might encounter when using Spring Data JDBC. The series consists of

  1. Spring Data JDBC - How to use custom ID generation. (this article).

  2. Spring Data JDBC - How do I make bidirectional relationships?

  3. Spring Data JDBC - How do I implement caching?

  4. Spring Data JDBC - How Can I Do a Partial Update of an Aggregate Root?

  5. Spring Data JDBC - How do I Generate the Schema for my Domain Model?

If you are new to Spring Data JDBC, you should start by reading its introduction and this article, which explains the relevance of aggregates in the context of Spring Data JDBC

Get ahead

VMware offers training and certification to turbo-charge your progress.

Learn more

Get support

Tanzu Spring Runtime offers support and binaries for OpenJDK™, Spring, and Apache Tomcat® in one simple subscription.

Learn more

Upcoming events

Check out all the upcoming events in the Spring community.

View all