My last habit was to convert entity to immutable dto (service layer) and then when I'd like to update object I converted another time dto (at controller layer) to bean. In this case I have 2 mapping. When I need to add some attribute I have to change 3 objects.
I always assume that entity can't go out from service, so my new idea to improve this solution.
Now I try one of case:
- use class with excluding interface .
- create builder as now with getters.
Other idea is to use mutable beans when I plan to update object or immutable in other case.
No comments:
Post a Comment