Reputation: 3
I write in java and try using DDD.
App schema (Interfaces is controllers, GUI etc.)
My question is:
Upvotes: 0
Views: 1376
Reputation: 60
How save data to database from aggregation root without getters. I would like have only >clean buissnes behavior. Maybe my aggregation root should create DTO object?(but is smell)
May be you are looking for ports-and-adapters architecture pattern.
Usual approach - place business and infrastratucture code in same package but in different modules
You even can make your AR non-public without public getters/setters.
Example:
https://github.com/ddd-by-examples/factory
look at
Examples of Domain Model in code: aggregate ProductDemand entity DailyDemand
in description - ProductDemand and DailyDemand not public, placed in demand-forecasting-model module at package io.dddbyexamples.factory.demand.forecasting
Now look at package io.dddbyexamples.factory.demand.forecasting in module demand-forecasting-adapters and you will see infrastructure implemmentation
Upvotes: 1