I have a Customer which can have sereval address. Sereval customers can possibily live at the same address. So in my relational database a classic many to many relationship.
- An address can not change (a customer can change address);
- It does not involve any logic with side effect.
- And the equility between two adress is determine only with the values in it.
I argue address is a good candidate to be a value object.
However I need (or maybe not) to persist my customers address and to do so I need to add an Id.
I am a little bit confused and struggled, I think pure domain logic and common sens tell me is a value object but the technology constraint makes that an address has an Id.
Is it fine to store value object?