Are persistence annotations in domain objects a bad practice?

前端 未结 8 1085
青春惊慌失措
青春惊慌失措 2021-02-01 15:09

I realize that persistence frameworks such as Morphia and Hibernate rely on annotations on domain objects to do their magic. At some level, it seems to me that this is insertin

8条回答
  •  感动是毒
    2021-02-01 15:31

    I would prefer rich domain objects which have the annotations on it. Even Evans uses this approach in his sample app. He uses XMl instead of Annotations but he still persists the same objects.

    Maybe it´s more clean to separate domain and persistence but don´t do just to be able to potentially choose a different db technology in the future. It´s the way down to complexity hell and Mister YAGNI will bite you.

提交回复
热议问题