-->
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.  [ 2 posts ] 
Author Message
 Post subject: Feedback about group and groupsequence
PostPosted: Sat Mar 12, 2011 6:48 am 
Newbie

Joined: Tue Feb 02, 2010 9:00 am
Posts: 19
Hi,

I think that current status of the bean validation is little restricted or counter intuitive.

In our application we have such a case:

1) Constraints should be evaluated in particular order. (cheap to expensive)
2) Constraints should not be evaluated after a violation per field.
3) All fields should be validated.

For first two, groupsequence is fitting very good. However for my 3rd requirement I could not find a way to solve.


Code:
public class AccountBean {

   @CheepValidation
   @ExpensiveValidation
   @VeryExpensiveValidation
   private String name;

   @CheepValidation
   @ExpensiveValidation
   @VeryExpensiveValidation
   private String surname
}



For example,

Let's say that, for name field VeryExpensiveValidationconstraint is violated and for surname field ExpensiveValidation constraint is violated.

For this case I am expecting such a scenario. I should display:

For field name: Only VeryExpensiveValidation error message
For field surname: Only ExpensiveValidation error message

Note that for field surname we did not evaluate VeryExpensiveValidationconstraint.

I started to think that after reading spec and making practice validation framework is great but in terms of ordering constraint for per field is very difficult. (I could not find at least.)

Intuitively I was expecting an annotation like OrderedValidation.

Code:
public class AccountBean {
   
   @OrderedValidation(order =  {CheepValidation,ExpensiveValidation,VeryExpensiveValidation}, stopOnError=true)
   @CheepValidation
   @ExpensiveValidation
   @VeryExpensiveValidation
   private String name;


   @OrderedValidation(order =  {CheepValidation,ExpensiveValidation,VeryExpensiveValidation}, stopOnError=true)
   @CheepValidation
   @ExpensiveValidation
   @VeryExpensiveValidation
   private String surname
}



Forgive my ignorance please if I made a mistake. I would like thank again for such a great validation api.

Thanks


Top
 Profile  
 
 Post subject: Re: Feedback about group and groupsequence
PostPosted: Fri Mar 18, 2011 11:01 am 
Newbie

Joined: Tue Feb 02, 2010 9:00 am
Posts: 19
Any comment about it? I would be very glad any answer about this.


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

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:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.