Integration with Hibernate Validator

251 views
Skip to first unread message

Drew

unread,
Dec 17, 2010, 6:04:07 PM12/17/10
to play-framework
How can I integrate with Hibernate Validator. Currently, I have both
Play and Hibernate Validator annotations on my entities and that's
totally non DRY. Any tips?

Thanks,

Drew

Marcos Pereira

unread,
Dec 21, 2010, 9:41:54 PM12/21/10
to play-fr...@googlegroups.com
Hum, 

I guest that is not that hard to create an adapter that translate hibernate validator "invalid stuff" to play "invalid stuff". The only case that I don't have a clue about what to do is when you are using @Valid annotation in your controllers:

public static void save(@Valid Post post) {
    ...
}

Anyway, why are you using both? Are you reusing some JPA/Model code?

--
You received this message because you are subscribed to the Google Groups "play-framework" group.
To post to this group, send email to play-fr...@googlegroups.com.
To unsubscribe from this group, send email to play-framewor...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/play-framework?hl=en.


Drew

unread,
Dec 22, 2010, 1:20:03 PM12/22/10
to play-framework
Yes I am reusing some of the entities. And in general it's always good
to validate the entities in UI and in backend too.

Do you know how I can go about creating an adapter? I don't care too
much about the @Valid annotation.

On Dec 21, 6:41 pm, Marcos Pereira <marcos.si...@gmail.com> wrote:
> Hum,
>
> I guest that is not that hard to create an adapter that translate hibernate
> validator "invalid stuff" to play "invalid stuff". The only case that I
> don't have a clue about what to do is when you are using @Valid annotation
> in your controllers:
>
> public static void save(@Valid Post post) {
>     ...
>
> }
>
> Anyway, why are you using both? Are you reusing some JPA/Model code?
>
> --http://about.me/marcospereira
>
> On Fri, Dec 17, 2010 at 9:04 PM, Drew <d...@venarc.com> wrote:
> > How can I integrate with Hibernate Validator. Currently, I have both
> > Play and Hibernate Validator annotations on my entities and that's
> > totally non DRY. Any tips?
>
> > Thanks,
>
> > Drew
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "play-framework" group.
> > To post to this group, send email to play-fr...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > play-framewor...@googlegroups.com<play-framework%2Bunsu...@googlegroups.com>
> > .
Reply all
Reply to author
Forward
0 new messages