[TYPO3-50-general] Database Persistence / Transaction Support
Nino Martincevic
don at zampano.com
Sat Aug 15 02:13:54 CEST 2009
Duo Zheng schrieb:
> If Aggregate roots and Aggregates are connected via "Foreign Key"
> relations in the DB backend, are there already methods in place to
> handle the inserts since the "Auto Increment ID" is required for
> nested Aggregates? The Persistent Manager handles the commits so I
> wanted to clarify this. (I hope that was clear)
Huh? Nested aggregates? Not in DDD...do you mean Entities?
> For the sake of the example this is all one request / transaction:
> * Blog gets created
> * First post gets created, but it needs the Blog Id from the just
> created Blog.
Question to ask here: who creates the post?
If the boundary for this operation is the Blog AR, then you have the
relation already. Always think of aggregates as consistency boundaries.
ARs aren't a structural property of the domain model but a conceptual
one. An object might be an Entity in one AR in one use case/context and
the AR itself in another one.
From the original definition by Evans:
"[ARs are] A cluster of associated objects that are treated as a unit
for the purpose of data changes. ... . A set of consistency rules
applies within the Aggregate's boundaries."
The kind of relationships you're talking about are usually handled by an
Unit of Work in the persistence layer/ORM.
Cheers!
More information about the TYPO3-project-5_0-general
mailing list