Optional in Entity But Mandatory when searching

I’ve an entity Customer which has a field Zip which is optional but someone tries to search the customer zip is mandatory ( this is just an example for the sake of simplicity) . How can I make this as a required field in binder? Should I create a different class for this ?

So you want to make a field like Optional zip required in the UI? I’d be surprised if there is a ready made validator for that. Nor field. So you need to write custom Converter and custom Validator. Validator you can build either is a Vaadin Validator or by creating custom BeanValidation annotation and ConstrainValidator.

Thanks., Let me see if any examples are there.