DDD, can different domain models rely on the same set of tables

The DDD directive states that domain models should not have anything to do with persistence. This means that different domain models can rely on the same tables. Meanwhile, it seems that this goal is quite difficult to achieve, due to the technical limitations in ORM in transformational models (I suppose?). Is there a way, with actual ORMs, to create very specific domain models that rely on the same tables in the database, and prevent disappointing comparisons [1: 1] between entities and tables available in 99.99% of the DDD implementation? Do these technical restrictions (?) Set outdated recommendations?

Thank,

+4
source share
4 answers

The “disappointing [1: 1] mapping” between entities and tables can disappoint you in two ways: not being able to populate an entity from multiple tables and not being able to populate multiple objects from a single table.

It seems to you that you are more interested in the latter, it is possible with most ORMs, even if only by defining different mappings for the same table in separate “instances” of the ORM display. The solution for the Entity Framework is described here and here .

+2
source

, , . , , DDD, ORM. . , DDD , .

, . ORM , , .

, DDD 1:1 . , , .

+1

Java, MyBatis, Data Mapper .

+1

DDD - , , :

, DDD , .

  • , DDD, , , , , 1:1 , JPA/Hibernate... ..
  • In a project with a brown field with an existing database that cannot be modified, one database can support several limited contexts, and it is possible that some tables may have different parts of their columns mapped to different domain objects in different limited contexts.

There is a good discussion of this issue on pages 66-66 in the book Implementing Domain-Driven Design by Vaughn Vernon.

0
source

All Articles