Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Bean validation 2.0 question
PostPosted: Mon Nov 21, 2016 4:54 pm 
Newbie

Joined: Mon Nov 21, 2016 4:48 pm
Posts: 1
Trying bean validation 2.0 with 5.3.2.

I am trying to validate the following property using beanvalidation API and 5.3.2 version of the validator.

@Valid
public List<@NotNull String> strings;

When I try to validate it with the list ["1", null, "2"] it succeeds even though I expect it to fail due to the NULL value.
Looking at the ValidatorImpl class it appears to skip over the validation in the validatePropertyForSingleDefaultGroupElement method because metaConstraints are empty (typeUseConstraints are not empty).

Do I need to declare something else to make this work?

Thanks,
Alex


Top
 Profile  
 
 Post subject: Re: Bean validation 2.0 question
PostPosted: Wed Nov 23, 2016 10:54 am 
Hibernate Team
Hibernate Team

Joined: Sat Jan 24, 2009 12:46 pm
Posts: 384
Which method on `Validator` are you invoking? I reckon it's validateValue() or validateProperty()? Note that cascaded validation isn't supported for these in the BV spec, although HV (the implementation) is trying to do it. If you file an issue in our JIRA tracker with a small but complete example, we can try and take a look.

Btw. BV 2.0 is in the works currently, HV 5.3.2 implements BV 1.1. We already have experimental support for collection element constraints as you are trying to use them in there, but it's a proprietary feature currently and specific semantics may change once the feature is standardized in BV 2.0.

Cheers,

--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.