Say I have two entities, Person and Address. Person has an Address. (Address address = person.getAddress()). I want to enter the Person properties and Address properties on different pages within the same conversation.
When I click "continue" on the Person input page, I want SEAM to validate the Person entity, and if valid, display the Address input page.
When I click "continue" on the Address input page, I want SEAM to validate the Address entity, and if valid, display a confirmation page...
I have Person scoped to the SessionContext, and it is injected into my Action component. Person validation is working, but Address validation is not.
I think I can solve the problem by putting Address in the conversationContext and injecting it to my Action component and annotating it as @In @Valid. Then, before ending the conversation, I set the Address in the context onto the Person and persist the Person.
But perhaps there is a more elegant way?
@Valid Addess address
will only cause validation to occur if address is non-null.
So leave it null until you are ready to have it be validated.