Spring JPA Repositories vs. DDD Repositories

458 views
Skip to first unread message

Arun Nair

unread,
Sep 6, 2018, 12:13:36 AM9/6/18
to DDD/CQRS
Hi,
  I am assuming the JPA  repositories provided by Spring (https://docs.spring.io/spring-data/commons/docs/current/api/org/springframework/data/repository/CrudRepository.html )  are not the same as the DDD Repository pattern, and belong in the Data Access Layer. 

Is my assumption correct?

Thank you,
Arun 

Veranildo Veras

unread,
Oct 3, 2018, 4:48:05 PM10/3/18
to DDD/CQRS
It is not. A repository in DDD is a collection of objects and not an entity, for example: The order repository is an aggregate root in the context of sales, it is responsible for saving the order, items (products, amounts), customer and delivery address, etc. None of the aggregates (items, customer and delivery address) will be persisted individually.

I hope this helps.
Reply all
Reply to author
Forward
0 new messages