I'm happy to announce, that Spring Data JDBC and R2DBC finally support Composite IDs starting with version 4.0.0-M4. Most of you probably know, but just to make sure everyone has the same understanding:
From the database point of view a composite id (or composite key) is a primary key that consists of more than one column.
On the Java side these columns get mapped to an entity with an attribute for each column
Usage should be straight forward and I'll demonstrate it in the following article for JDBC.
Usage in R2DBC is anlogous. To get started just put an @Id annotation on a field in your…
On behalf of the team and everyone who has contributed, I’m pleased to announce the availability of 2024.1.0-M1, 2024.0.4, and 2023.1.10 releases. These releases ship with dependency upgrades, fixes for regressions and selected improvements. The upcoming Spring Boot releases 3.4.0-M3, 3.3.4, respective 3.2.10 will pick up the above releases by next week. 2024.1.0-M1 Spring Data Commons 3.4 M1 - Javadoc - Documentation - Changelog Spring Data JPA 3.4 M1 - Javadoc - Documentation - Changelog Spring Data MongoDB 4.4 M1 - Javadoc - Documentation - Changelog Spring Data for Apache Cassandra 4.4 M…
On behalf of the team and everyone who has contributed, I’m pleased to announce the availability of 2024.0.3 and 2023.1.9 service releases. These releases ship with dependency upgrades, fixes for regressions and selected improvements. The upcoming Spring Boot releases 3.3.3, respective 3.2.9 will pick up the above releases by next week. 2024.0.3 Spring Data Commons 3.3.3 - Javadoc - Documentation - Changelog Spring Data JPA 3.3.3 - Javadoc - Documentation - Changelog Spring Data MongoDB 4.3.3 - Javadoc - Documentation - Changelog Spring Data for Apache Cassandra 4.3.3 - Javadoc - Documentation…
On behalf of the team and everyone who has contributed, I’m pleased to announce the availability of 2024.0.2 and 2023.1.8 service releases. These releases ship with dependency upgrades, fixes for regressions and selected improvements. The upcoming Spring Boot releases 3.3.2, respective 3.2.8 will pick up the above releases by next week. 2024.0.2 Spring Data Commons 3.3.2 - Javadoc - Documentation - Changelog Spring Data JPA 3.3.2 - Javadoc - Documentation - Changelog Spring Data MongoDB 4.3.2 - Javadoc - Documentation - Changelog Spring Data for Apache Cassandra 4.3.2 - Javadoc - Documentation…
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…
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: Spring Data JDBC - How to use custom ID generation? Spring Data JDBC - How do I make bidirectional relationships?. Spring Data JDBC - How do I implement caching? Spring Data JDBC - How Can I Do a Partial Update of an Aggregate Root? 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…
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…
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.…
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: Spring Data JDBC - How to Use Custom ID Generation. Spring Data JDBC - How Do I Make Bidirectional Relationships? Spring Data JDBC - How Do I Implement Caching? Spring Data JDBC - How Can I Do a Partial Update of an Aggregate Root? (this article) 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…
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…