The Hibernate validation with Seam is very usefull because you don't need to 
add the validation rules within the presentation (facelets/JSF view).

Sometime, I cannot use an Entity bean with the @Valid annotation.  So, I add 
fields in my Stateful session bean, but with this approach I need to add my 
validation everywhere and cannot reuse validation component easily.  

It will be great, if we can use the same annotations from the Hibernate 
validation framework in that context too.

Here's an example:

  | @Stateful
  | @Name("damFinder")
  | @Interceptors(SeamInterceptor.class)
  | public class DamFinderImpl implements IDamFinder {
  |   private String code;
  | 
  |   @NotNull
  |   @Length(min = 1, max = 100)
  |   public String getCode() {
  |       return this.code;
  |   }
  | 
  |   public void setCode(String aCode) {
  |       this.code = aCode;
  |   }
  |   
  |   @IfInvalid(outcome = Outcome.REDISPLAY)
  |   public String search() {
  |      // DO THE SEARCH, and the fields are validated
  |   }
  | 

I don't know how much work this feature requires but I'm sure it will helps me 
to write my code faster and removes the code duplication.

We can push the feature a little further and adjust the maxlenght attribute of 
the JSF inputText tag the same way Hibernate adjust his the property mapping 
with annotations.  

I know I'm a dreamer ;-)  maybe one day!


View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3929168#3929168

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3929168


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to