-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Unable to setGroup Sequence on Validation groups
PostPosted: Fri Jan 08, 2010 6:09 am 
Newbie

Joined: Fri Jan 08, 2010 5:41 am
Posts: 1
Hi,

Im trying to implement both validation groups and group sequence on the same form object, but Im having a problem whereby the group sequence is being ignored.

Suppose I have defined the group sequence on my form object class as follows :

@GroupSequence({User.class, Level1.class, Level2.class})
public class User {

@Min(value = 11111,groups={Step1.class,Level2.class})
@Pattern(regexp = "[0-9]{5}",groups={Step1.class,Level1.class})
private String name;

@Size(min=1,groups=Step2.class)
private String employeeId;

public String getName() {
return name;
}

public void setName(String name) {
this.name= name;
}

public String getEmployeeId() {
return employeeId;
}

public void setEmployeeId(String employeeId) {
this.employeeId = employeeId;
}
}


Inside my controller class, I validate only for the Step1 group
Validator validator = Validation.buildDefaultValidatorFactory().getValidator();
ConstraintViolation<User> constraint = validator.vaidate(user,Step1.class);
System.out.println(constraint.getMessage());


Suppose the User object's name field was set to "a", I would thus be expecting only the @Pattern validation to be performed, which is according to my group sequence defined. However, the constaint object returned displayed both the @Min and @Pattern errors.

Any help would be appreciated.

Thanks,
Jon


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.