Bean Validation was invented just for this occasion.
You annotate your entities with constraints, and these constraints will be met by both your business logic (via EJB, CDI, and / or JPA) and JSF.
For a small number of checks that you cannot express using Bean Validation, but are really business related; yes, throw an exception, catch it in your Bean support and set the appropriate Faces message (hint: use OmniFaces messages to make it easier). Similarly, for a small number of checks that you cannot express using Bean Validation and which are highly view-oriented; Use built-in JSF validators.
Mike braun
source share