JPAContainer: Best practice database validations

Hi,

I’m looking into using the JPAContainer together with BeanValidationForm but I’m not sure how to implement validations not handled by javax.validation. For example I might need to look up stuff in various tables before allowing the user to save (commit the form).

Should I simply add such validations before calling Form.commit? Or is there some way of adding custom validations, for example using some kind of listeners?

Kind regards,
Roland

Hi,

In case you validators depend on just on field you can add additional validators by hand. All validator should pass until to value is committed.

If you are validating something where your validation logic needs values of multiple fields the approach of overriding commit message is the way to go. Form really should have have validators that would be checked after all individual fields are checked, but that is a missing feature.

cheers,
matti