Domain object graph, JSF managed bean, CQRS commands

I have a big object graph (to capture the customer config in a multi-tenant app) that I am currently modeling. The goal is to build a provisioning UI that the client can use for self-provisioning. The issue:

When using CQRS, we want to have Commands responsible for any state changes. This means that I end up duplicating whatever properties my domain model has into command objects as well as JSF managed bean. I feel this is lot of duplication. Am I thinking it wrong? Any ideas?

Hi Pangea,

did you considered using the JSF managed beans directly as your command objects? I am not a JSF expert, so I am not sure whether these beans are safe to use outside of the JSF context.

Duplicating properties is something you will always have. In many cases, I try to combine several strongly related properties into a single “value object”. That reduces the amount of property copying.