[hibernate-issues] [Hibernate-JIRA] Updated: (HV-444) Default group sequence defined with programmatic API is not used if the configured class doesn't define programmatic constraints

Kevin Pollet (JIRA) noreply at atlassian.com
Wed Mar 2 15:21:08 EST 2011


     [ http://opensource.atlassian.com/projects/hibernate/browse/HV-444?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kevin Pollet updated HV-444:
----------------------------

    Description: 
If constraints and default group sequence are defined with the programmatic API, the following code doesn't work (no validation error).

{code}
class A {
    String a;
}

class B extends A {

}

public interface Foo {

}

ConstraintMapping mapping = new ConstraintMapping();
mapping.type( B.class )
       .defaultGroupSequence( Foo.class, B.class )
       .type( A.class )
       .property( "a", ElementType.FIELD )
       .constraint( NotNullDef.class ).groups( Foo.class );

HibernateValidatorConfiguration config = Validation.byProvider( HibernateValidator.class ).configure();
ValidatorFactory factory = config.addMapping( mapping ).buildValidatorFactory();
Validator validator = factory.getValidator();

validator.validate( new B() );
{code}

  was:
If constraints and default group sequence are defined with the programmatic API the following code doesn't work (no validation error) .

{code}
class A {
    String a;
}

class B extends A {

}

public interface Foo {

}

ConstraintMapping mapping = new ConstraintMapping();
mapping.type( B.class )
       .defaultGroupSequence( Foo.class, B.class )
       .type( A.class )
       .property( "a", ElementType.FIELD )
       .constraint( NotNullDef.class ).groups( Foo.class );

HibernateValidatorConfiguration config = Validation.byProvider( HibernateValidator.class ).configure();
ValidatorFactory factory = config.addMapping( mapping ).buildValidatorFactory();
Validator validator = factory.getValidator();

validator.validate( new B() );
{code}


> Default group sequence defined with programmatic API is not used if the configured class doesn't define programmatic constraints
> --------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HV-444
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HV-444
>             Project: Hibernate Validator
>          Issue Type: Bug
>          Components: engine
>    Affects Versions: 4.2.0.Beta1
>            Reporter: Kevin Pollet
>             Fix For: 4.2.0.Beta2
>
>
> If constraints and default group sequence are defined with the programmatic API, the following code doesn't work (no validation error).
> {code}
> class A {
>     String a;
> }
> class B extends A {
> }
> public interface Foo {
> }
> ConstraintMapping mapping = new ConstraintMapping();
> mapping.type( B.class )
>        .defaultGroupSequence( Foo.class, B.class )
>        .type( A.class )
>        .property( "a", ElementType.FIELD )
>        .constraint( NotNullDef.class ).groups( Foo.class );
> HibernateValidatorConfiguration config = Validation.byProvider( HibernateValidator.class ).configure();
> ValidatorFactory factory = config.addMapping( mapping ).buildValidatorFactory();
> Validator validator = factory.getValidator();
> validator.validate( new B() );
> {code}

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