-->
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.  [ 3 posts ] 
Author Message
 Post subject: Hibernate Validator - HV000151
PostPosted: Tue Jun 25, 2013 2:55 pm 
Newbie

Joined: Tue Jan 01, 2008 10:14 am
Posts: 3
Location: Toronto
I have a CXF web service that is defined as an interface and the implementation as a concrete class. I'm using Hibernate Validator via an aspect to perform validation via an ExecutableValidator. This results in the above mentioned HV000151 error being thrown - "A method overriding another method must not alter the parameter constraint configuration" due to the service interface being seen as defining the method as abstract but the implementation (obviously) not. Is there any way around this, or is this a bug?

Michael

_________________
CodeOgre


Top
 Profile  
 
 Post subject: Re: Hibernate Validator - HV000151
PostPosted: Wed Jun 26, 2013 9:07 am 
Hibernate Team
Hibernate Team

Joined: Sat Jan 24, 2009 12:46 pm
Posts: 388
Can you post the definition if your interface and implementation methods?

The exception is raised if you add parameter constraints to a method which overrides or implements a super-type method. This behavior is mandated by the Bean Validation spec (see http://beanvalidation.org/1.1/spec/#constraintdeclarationvalidationprocess-methodlevelconstraints-inheritance) in order to obey to the Liskov substitution principle:

Quote:
In sub types (be it sub classes/interfaces or interface implementations), no parameter constraints may be declared on overridden or implemented methods, nor may parameters be marked for cascaded validation. This would pose a strengthening of preconditions to be fulfilled by the caller.


To solve the issue, add the constraints to the interface method instead of the implementation method.

--Gunnar

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


Top
 Profile  
 
 Post subject: Re: Hibernate Validator - HV000151
PostPosted: Fri Jun 28, 2013 12:27 pm 
Newbie

Joined: Tue Jan 01, 2008 10:14 am
Posts: 3
Location: Toronto
Interesting - I moved the annotations from the implementation to the interface and the problem merrily went away. I feel a wee bit silly for not having tried that myself. Thanks for the information.

_________________
CodeOgre


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