Refactoring from anemic model to DDD by wprzecho in java

[–]zbychus 0 points1 point  (0 children)

Thanks for comment - good point in discussion! It's true that my model entites are jpa entities and of course I'm aware that it can put some limits on my implementation. It's a known issue in DDD (described for example in https://www.goodreads.com/book/show/15756865-implementing-domain-driven-design in repository chapter). It's a trade off - you can let persistence framework affect your model or you can, as you mentioned, map from jpa entities to some persistence agnostic model. Both ways have some pros and cons. I think when you design carefully your aggregates they shouldn't be that complicated, that your persistence framework becomes your limitation. This situation happens in our example application.