So far this is what I've got. Doesn't do anything with groups or the more
advanced stuff but this may be all it takes.

public class BeanComponentValidator<T> extends AbstractValidator<T> {


    public BeanComponentValidator() {
        super();
    }


    @Override
    protected void onValidate(IValidatable<T> validatable) {
        for(ConstraintViolation<T> violation :
validate(validatable.getValue())) {
            validatable.error(new
ValidationError().addMessageKey(violation.getMessage()));
        }

    }

    Set<ConstraintViolation<T>> validate(T value) {
        Validator validator =

 Validation.buildDefaultValidatorFactory().getValidator();//this may only be
working because I'm using Spring 3.0.2 and Hibernate 3.5 I don't know for
sure.
        return validator.validate(value);
    }
}


On Mon, Apr 5, 2010 at 12:15 PM, Martin Makundi <
martin.maku...@koodaripalvelut.com> wrote:

> Hi!
>
> It's quite easy to add trivial min/max/required validators using (any)
> helper method. Maybe bindgen project would be closest to this.. it's
> already working with annotations, it could perhaps parse also
> annotations of property target objects.
>
> **
> Martin
>
> 2010/4/5 David Chang <david_q_zh...@yahoo.com>:
> > Using Hibernate Validator may bring a few good things:
> >
> > 1. On the data end, it helps to improve data, performance, etc. Also the
> annotation you write on domain objects get translated into database creation
> and objects save/update. You can find more on in this area. Obviously, this
> has nothing to do with wicket.
> >
> > 2. Regarding the web tier, it is often needed to write validation rules
> such as not null or the maximum chars in an input field being less than 10.
> In pure wicket, you have to add many validation rules yourself manually for
> each field. Why should I do so second time in wicket if I can explicitly
> specify them on domain objects via Hibernate Validator (or Bean Validation,
> JSR 303, now official)? I hope to see wicket can take adavantage of bean
> validation to let us code faster and have more maintainable code.
> >
> > Please feel free to comment I am wrong.
> >
> > Best.
> >
> >
> >
> >
> >
> > --- On Mon, 4/5/10, Martin Makundi <martin.maku...@koodaripalvelut.com>
> wrote:
> >
> >> From: Martin Makundi <martin.maku...@koodaripalvelut.com>
> >> Subject: Re: Any "mature" work on integrating Hibernate Validator with
> Wicket?
> >> To: users@wicket.apache.org
> >> Date: Monday, April 5, 2010, 11:31 AM
> >> Do you have any user stories on the
> >> topic? It would be useful to
> >> evaluate how interesting the use case is. Me myself I
> >> cannot immagine
> >> anything "useful" could come out of hibernate validators,
> >> only
> >> something very trivial. Could be wrong, thoug.
> >>
> >> **
> >> Martin
> >>
> >> 2010/4/5 David Chang <david_q_zh...@yahoo.com>:
> >> >
> >> > thanks for chiming in. sorry if i was not clear in
> >> prevoius posts.
> >> >
> >> > i would like to hear comments whether it is worthy to
> >> explore or any benefits. i also would like to know whether
> >> there is more "mature" work since i only found experimental
> >> work. i am unable to find anything aobut it on wicketstuff.
> >> >
> >> > regards.
> >> >
> >> >
> >> > --- On Mon, 4/5/10, Igor Vaynberg <igor.vaynb...@gmail.com>
> >> wrote:
> >> >
> >> >> From: Igor Vaynberg <igor.vaynb...@gmail.com>
> >> >> Subject: Re: Any "mature" work on integrating
> >> Hibernate Validator with Wicket?
> >> >> To: users@wicket.apache.org
> >> >> Date: Monday, April 5, 2010, 11:21 AM
> >> >> you have answered your own question
> >> >> twice, why does anyone else need to reply?
> >> >>
> >> >> -igor
> >> >>
> >> >> On Mon, Apr 5, 2010 at 8:01 AM, David Chang <david_q_zh...@yahoo.com
> >
> >> >> wrote:
> >> >> >
> >> >> > Hi folks, I feel a bit puzzled about not
> >> getting any
> >> >> response on this topic. I have to say that I am
> >> new in
> >> >> Wicket. If this a bad or wrong question or if this
> >> is
> >> >> something not worthy to explore, please feel free
> >> to let me
> >> >> know.
> >> >> >
> >> >> > Thanks for any input!
> >> >> >
> >> >> >
> >> >> > --- On Sun, 4/4/10, David Chang <david_q_zh...@yahoo.com>
> >> >> wrote:
> >> >> >
> >> >> >> From: David Chang <david_q_zh...@yahoo.com>
> >> >> >> Subject: Re: Any "mature" work on
> >> integrating
> >> >> Hibernate Validator with Wicket?
> >> >> >> To: users@wicket.apache.org
> >> >> >> Date: Sunday, April 4, 2010, 11:31 PM
> >> >> >> Found another related work.
> >> >> >>
> >> >> >>
> http://42lines.net/content/integrating-hibernate-validator-and-wicket
> >> >> >>
> >> >> >> Any comment or pointers regarding
> >> relatively
> >> >> "mature" work
> >> >> >> in this regard?
> >> >> >>
> >> >> >> Regards.
> >> >> >>
> >> >> >>
> >> >> >> --- On Sat, 4/3/10, David Chang <david_q_zh...@yahoo.com>
> >> >> >> wrote:
> >> >> >>
> >> >> >> > From: David Chang <david_q_zh...@yahoo.com>
> >> >> >> > Subject: Any "mature" work on
> >> integrating
> >> >> Hibernate
> >> >> >> Validator with Wicket?
> >> >> >> > To: users@wicket.apache.org
> >> >> >> > Date: Saturday, April 3, 2010, 1:45
> >> PM
> >> >> >> >
> >> >> >> > Is there any "mature" work on
> >> integrating
> >> >> Hibernate
> >> >> >> > Validator with Wicket?
> >> >> >> >
> >> >> >> > I am unable to find any at
> >> wicketstuff.
> >> >> Googled and
> >> >> >> found
> >> >> >> > this work is interesting.
> >> >> >> >
> >> >> >> > http://carinae.net/tag/hibernate-validator/
> >> >> >> >
> >> >> >> > Any pointers?
> >> >> >> >
> >> >> >> > Any comment?
> >> >> >> >
> >> >> >> > Thanks and Happy Easter!
> >> >> >> >
> >> >> >> >
> >> >> >> >
> >> >> >> >
> >> >> >> >
> >> >> >>
> >> >>
> >> ---------------------------------------------------------------------
> >> >> >> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> >> >> >> > For additional commands, e-mail: users-h...@wicket.apache.org
> >> >> >> >
> >> >> >> >
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >>
> >> >>
> >> ---------------------------------------------------------------------
> >> >> >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> >> >> >> For additional commands, e-mail: users-h...@wicket.apache.org
> >> >> >>
> >> >> >>
> >> >> >
> >> >> >
> >> >> >
> >> >> >
> >> >> >
> >> >>
> >> ---------------------------------------------------------------------
> >> >> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> >> >> > For additional commands, e-mail: users-h...@wicket.apache.org
> >> >> >
> >> >> >
> >> >>
> >> >>
> >> ---------------------------------------------------------------------
> >> >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> >> >> For additional commands, e-mail: users-h...@wicket.apache.org
> >> >>
> >> >>
> >> >
> >> >
> >> >
> >> >
> >> >
> >> ---------------------------------------------------------------------
> >> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> >> > For additional commands, e-mail: users-h...@wicket.apache.org
> >> >
> >> >
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> >> For additional commands, e-mail: users-h...@wicket.apache.org
> >>
> >>
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> > For additional commands, e-mail: users-h...@wicket.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

Reply via email to