Help

Built with Seam

You can find the full source code for this website in the Seam package in the directory /examples/wiki. It is licensed under the LGPL.

Hibernate Validator collects all validation failures that occur prior to a persistence operation and stores them inside of the exception that it throws. Therefore, in your business method, you simply have to catch this exception and turn each violation into a JSF message:

try
{
    return super.persist();
}   
catch (org.hibernate.validator.InvalidStateException ex)
{
    for (org.hibernate.validator.InvalidValue iv : ex.getInvalidValues())
    {
        org.jboss.seam.faces.FacesMessages.instance().add(iv.getMessage());
    }   
    
    return "invalid";
}

You can also inspect the InvalidValue for the property name if you want to associate the message with a clientId, but you don't have the full property path, so how well that will work depends on your situation.