-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 
Author Message
 Post subject: Hibernate Validator throwing ValidationException on unwrap
PostPosted: Thu Jun 13, 2013 12:26 pm 
Newbie

Joined: Thu Jun 13, 2013 12:15 pm
Posts: 4
Hi,

While trying to invoke the method validator using an interceptor, am getting the ValidationException during unwrap method call.
The project setup includes GWT, Guice, Hibernate Validator 4.2, validation API 1.0. The validation is being invoked at GWT server layer.

Same error occured while trying to get an ExecutableValidator instance using hibernate Validator 5.1 and validation API 1.1.

javax.validation.ValidationException: Type interface org.hibernate.validator.method.MethodValidator not supported
at org.hibernate.validator.engine.ValidatorImpl.unwrap(ValidatorImpl.java:157
at com.validation.demo.ValidationInterceptor.invoke(ValidationInterceptor.java:32)

Any idea why the bean validation provider implementaion is not being recognised?

Thanks.


Top
 Profile  
 
 Post subject: Re: Hibernate Validator throwing ValidationException on unwrap
PostPosted: Thu Jun 13, 2013 2:36 pm 
Hibernate Team
Hibernate Team

Joined: Sat Jan 24, 2009 12:46 pm
Posts: 388
In HV 5 there is no need for unwrapping the validator, as method validation is part of the BV API. Just invoke validator#forExecutables().

--Gunnar

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


Top
 Profile  
 
 Post subject: Re: Hibernate Validator throwing ValidationException on unwrap
PostPosted: Thu Jun 13, 2013 3:10 pm 
Newbie

Joined: Thu Jun 13, 2013 12:15 pm
Posts: 4
Hi Gunnar,

Thanks for the quick reply.

Using validator#forExecutables() was my first choice, but somehow the validator#forExecutables() method was not visible on the validator. So had to go for unwrap.

What could be wrong if I am not able to see forExecutables() on the validator instance. I tried using

Validation.buildDefaultValidatorFactory().getValidator().forExecutables()
even tried, Validation.byProvider(HibernateValidator.class).configure().buildValidatorFactory().getValidator().forExecutables()
but no success.

Thanks,
Gautam


Top
 Profile  
 
 Post subject: Re: Hibernate Validator throwing ValidationException on unwrap
PostPosted: Thu Jun 13, 2013 3:42 pm 
Newbie

Joined: Thu Jun 13, 2013 12:15 pm
Posts: 4
Hi Gunnar,

I think The Validator interface is referring to the validation API 1.0 jar version packaged with the GWT SDK and hence not finding the new methods.

How can we make it work with GWT which has older validation API?

Thanks


Top
 Profile  
 
 Post subject: Re: Hibernate Validator throwing ValidationException on unwrap
PostPosted: Thu Jun 13, 2013 6:26 pm 
Hibernate Team
Hibernate Team

Joined: Sat Jan 24, 2009 12:46 pm
Posts: 388
The validation feature of GWT 2.5 is based on Hibernate Validator 4.1.0 (as per https://developers.google.com/web-toolkit/doc/latest/DevGuideValidation) which doesn't support method validation and thus the unwrap() method always throws an exception (see https://github.com/hibernate/hibernate-validator/blob/4.1.0.Final/hibernate-validator/src/main/java/org/hibernate/validator/engine/ValidatorImpl.java).

So I think as it stands there is no way to make use of method validation on the client side. Of course you could use a newer HV version to perform method validation on the server side.

--Gunnar

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


Top
 Profile  
 
 Post subject: Re: Hibernate Validator throwing ValidationException on unwrap
PostPosted: Fri Jun 14, 2013 2:44 pm 
Newbie

Joined: Thu Jun 13, 2013 12:15 pm
Posts: 4
Thanks Gunnar...


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 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.