[hibernate-issues] [Hibernate-JIRA] Commented: (HV-381) Provide a fail fast switch to stop processing constraints on first failure

Kevin Pollet (JIRA) noreply at atlassian.com
Thu Feb 10 11:38:05 EST 2011


    [ http://opensource.atlassian.com/projects/hibernate/browse/HV-381?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=39911#action_39911 ] 

Kevin Pollet commented on HV-381:
---------------------------------

First off all it's just my opinion :)

Using {{failFast()}} instead of {{failFast(boolean)}} can be confusing if people wants to disable failFast locally on the Validator with {{usingContext}} method. Another point, if people use {{failFast(int maxFailures)}} to enable failFast what's the value to disable it ? 

I think {{failFast(boolean)}} is the best solution to enable/disable the functionnality. Continuing Gunnar's idea we might provide two overloaded methods like :

{code}
final Validator validator = factory.unwrap( HibernateValidatorFactory.class )
    .usingContext()
    .failFast()
       .maxFailures( 5 )
    .getValidator();
{code}

The above method enables failFast and allow to customize it with the max failures value.

{code}
final Validator validator = factory.unwrap( HibernateValidatorFactory.class )
    .usingContext()
    .failFast( false )
    .getValidator();
{code}

The above method could be used to simply enable it (maxFailures(1)) and to disable it. 

WDYT ?

> Provide a fail fast switch to stop processing constraints on first failure
> --------------------------------------------------------------------------
>
>                 Key: HV-381
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HV-381
>             Project: Hibernate Validator
>          Issue Type: Bug
>          Components: engine
>    Affects Versions: 4.1.0.Final
>            Reporter: Emmanuel Bernard
>            Assignee: Kevin Pollet
>             Fix For: 4.2.0.Beta2
>
>
> On first failure, HS should stop processing constraint failures and return straight.
> This should be both a {{ValidatorFactory}} setting and a {{Validator}} setting.

-- 
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