[hibernate-issues] [Hibernate-JIRA] Resolved: (ANN-514) Validator doesn't support validation based on value of other fields in the object

Emmanuel Bernard (JIRA) noreply at atlassian.com
Tue Jan 16 20:19:44 EST 2007


     [ http://opensource.atlassian.com/projects/hibernate/browse/ANN-514?page=all ]
     
Emmanuel Bernard resolved ANN-514:
----------------------------------

    Resolution: Rejected

There is no need for such a feature, the use case is already supported since bean level validation is supported

@PasswordChecking
public class User {
  ...
}

> Validator doesn't support validation based on value of other fields in the object
> ---------------------------------------------------------------------------------
>
>          Key: ANN-514
>          URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-514
>      Project: Hibernate Annotations
>         Type: Improvement

>   Components: validator
>     Versions: 3.2.1
>  Environment: Hibernate Annotations 3.2.1
>     Reporter: Rakesh Kalra

>
> Original Estimate: 5 days
>         Remaining: 5 days
>
> I really like Hibernate Validator. In the absense of this framework, I was going to write something similar.
> But, I see a major limitation. If validation of a field depends on the value of another field in the same object, 
> hibernate validator doesn't have a way to handle this.
> The simplest example is when the validator is used for forms. Forms sometimes have fields like "email" and "retypeEmail". 
> It would be great to be able to write a custom annotation:
>   @Match(property="retypeEmail")
>   public String getEmail(){
>     return email;
>    }
> where, getRetypeEmail() is also available in the same object.
> Another example is where validation of a credit card number, depends on the credit card type
> This feature can be implemented, by exposing the object being validated to the isValid() method. 
> Without changing the signature of this method, the object can be exposed via some kind
> of a ValidationContext object, which is stored as a ThreadLocal variable.
> Please let me know the best work around, until this feature can be implemented.
> Regards,
> Rakesh

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira




More information about the hibernate-issues mailing list