We use spring validation to validate our models before stuffing them into the database . So for example an
Order --> OrderItem
before saving the order to the database it is validated by OrderValidator
OrderValidator validates order delegates to OrderItemValidator for validating OrderItem with the Order. So the hierarchy or validators in this case looks like
OderValidator --> OrderItemValidator
Knowledge that order has orderItems is present in both validator and the model.
I am wondering if this is a sign of implicit duplication ( something similar to Parallel inheritance hierarchy code smell ). If yes , what are the ways I could avoid it ?