[hibernate-issues] [Hibernate-JIRA] Issue Comment Edited: (BVAL-220) Offer possibiltiy to skip validation on empty or null

Hardy Ferentschik (JIRA) noreply at atlassian.com
Fri Jan 27 06:30:15 EST 2012


    [ http://opensource.atlassian.com/projects/hibernate/browse/BVAL-220?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=42681#comment-42681 ] 

Hardy Ferentschik edited comment on BVAL-220 at 1/27/12 5:28 AM:
-----------------------------------------------------------------

Suggestion:

{code}
@ReportAsSingleViolation(shortCircuit=true) /* better name? */
@NotNull /* or @NotEmpty, or @Size(min=50)... */
@Constraint(validatedBy=MyValidator)
public @interface MyConstraint {}
{code}

Currently Hibernate Validator invokes MyValidator even if the value is null.  This is wasteful and pointless.  It also makes it hard to compose cheap vs. expensive validations, or prerequisite validations in a reusable way.  I don't believe this is addressed by the recent "OR" composition type addition to HVAL.

      was (Author: pediddle):
    Suggestion:

@ReportAsSingleViolation(shortCircuit=true) /* better name? */
@NotNull /* or @NotEmpty, or @Size(min=50)... */
@Constraint(validatedBy=MyValidator)
public @interface MyConstraint {}

Currently Hibernate Validator invokes MyValidator even if the value is null.  This is wasteful and pointless.  It also makes it hard to compose cheap vs. expensive validations, or prerequisite validations in a reusable way.  I don't believe this is addressed by the recent "OR" composition type addition to HVAL.
  
> Offer possibiltiy to skip validation on empty or null
> -----------------------------------------------------
>
>                 Key: BVAL-220
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/BVAL-220
>             Project: Bean Validation
>          Issue Type: New Feature
>          Components: spec-general
>            Reporter: Emmanuel Bernard
>
> https://issues.apache.org/jira/browse/EXTVAL-74

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list