aggregates

In both Spring Data JPA & Spring Data JDBC identifying aggregates is important because it leads to better code.

"An Aggregate is a cluster of domain objects that are treated as a single unit. It has a root entity, known as the Aggregate Root, which is the only entity that can be directly referenced from outside the aggregate." -- Search Labs AI Overview

Articles that are worth a read include:

  1. Spring Data JDBC, References, and Aggregates
  2. Are you supposed to have one repository per table in JPA? says "As repository is a concept derived from Domain Driven Design, thinking about database tables is the wrong approach. By definition you access aggregate roots from a repository. Effectively a repository is simulating a collection of these." and goes on to talk about very useful techniques.


Tags: databases, java

← Back home