Domain Driven Design: Entities, Value Objects, Aggregates and Roots with JPA (Part 1)
A friend with a relational database background was working on an OO domain modelling problem. I started talking about “aggregates” and “roots” and things like “make the contract entity an aggregate controlling the other entities” and that “external logic should speak to the object model via a few root entities”. So I wrote demo project is some Spring and JPA code in Java to demonstrate those concepts. This blog series will be some discussion around the design and implementation techniques.
A quick introduction to the entities, aggregates, value objects and roots with a links into the seminal textbook Domain Driven Design by Eric Evans is here. A timeless book on implementation the ideas in Spring and Java is Pojos In Action by Chris Richardson. The code in that book pre-dates JPA so uses Hibernate but I would still rate it as the “go to” book on this subject. In the next post we will take a quick detour into the use of JPA in the sample app.