Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Must Have @Valid with Groups
PostPosted: Tue Jan 15, 2013 9:56 am 
Newbie

Joined: Tue Jan 15, 2013 9:34 am
Posts: 1
Hi,

In my company we have a big problem with the @Valid annotation because it does not support groups to indicate when to propagate validation or not. We implement SOA Web Services with cannonical model, and many times the same entity appears twice in the same object graph with diferent behaviors, and some cases this entity must propagate validation and some cases not.

Example:
Code:
class PhoneMessage {

   @Valid(group=Group1.class)
   private Phone originPhone;

   @Valid(group=Group2.class)
   private Phone destinationPhone;

}


Anyone knows a elegant way to solve this with BV 1.0 ? The Beans Validation 1.1 will address this issue ?

Thanks,
Gilberto Holms


Top
 Profile  
 
 Post subject: Re: Must Have @Valid with Groups
PostPosted: Sat Apr 06, 2013 3:40 pm 
Hibernate Team
Hibernate Team

Joined: Sat Jan 24, 2009 12:46 pm
Posts: 386
Gilberto,

In Bean Validation 1.1 you can use group conversions (see http://beanvalidation.org/1.1/spec/#constraintdeclarationvalidationprocess-groupsequence-groupconversion) together with @Valid for that purpose.

--Gunnar

_________________
Visit my blog at http://musingsofaprogrammingaddict.blogspot.com/


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 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.