-->
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.  [ 5 posts ] 
Author Message
 Post subject: What is a payload parameter
PostPosted: Tue Oct 06, 2009 1:44 am 
Regular
Regular

Joined: Tue Feb 17, 2009 3:36 pm
Posts: 78
I get the following exception. Can someone tell me what a payload parameter is?
Quote:
ax.validation.ConstraintDefinitionException: org.hibernate.validation.constraints.Length contains Constraint annotation, but does not contain a payload parameter.
org.hibernate.validation.metadata.ConstraintHelper.assertPayloadParameterExists(ConstraintHelper.java:319)
org.hibernate.validation.metadata.ConstraintHelper.isConstraintAnnotation(ConstraintHelper.java:282)
org.hibernate.validation.metadata.BeanMetaDataImpl.findConstraintAnnotations(BeanMetaDataImpl.java:346)
org.hibernate.validation.metadata.BeanMetaDataImpl.findConstraints(BeanMetaDataImpl.java:406)
org.hibernate.validation.metadata.BeanMetaDataImpl.initFieldConstraints(BeanMetaDataImpl.java:258)
org.hibernate.validation.metadata.BeanMetaDataImpl.initClass(BeanMetaDataImpl.java:233)
org.hibernate.validation.metadata.BeanMetaDataImpl.createMetaData(BeanMetaDataImpl.java:205)
org.hibernate.validation.metadata.BeanMetaDataImpl.<init>(BeanMetaDataImpl.java:107)
org.hibernate.validation.metadata.BeanMetaDataImpl.<init>(BeanMetaDataImpl.java:97)
org.hibernate.validation.engine.ValidatorImpl.getBeanMetaData(ValidatorImpl.java:724)
org.hibernate.validation.engine.ValidatorImpl.validateInContext(ValidatorImpl.java:204)
org.hibernate.validation.engine.ValidatorImpl.validate(ValidatorImpl.java:119)


Top
 Profile  
 
 Post subject: Re: What is a payload parameter
PostPosted: Tue Oct 06, 2009 4:18 am 
Newbie

Joined: Thu Aug 27, 2009 8:21 am
Posts: 13
Add this code to your annotation and the problem will go away

Code:
public abstract Class<? extends Payload>[] payload() default {};


Top
 Profile  
 
 Post subject: Re: What is a payload parameter
PostPosted: Tue Oct 06, 2009 6:32 pm 
Regular
Regular

Joined: Tue Feb 17, 2009 3:36 pm
Posts: 78
bryan.dollery wrote:
Add this code to your annotation and the problem will go away

Code:
public abstract Class<? extends Payload>[] payload() default {};


I don't follow this one. Let's say a domain class Owner. Do you mean that I need to have something like:
Code:

class Owner {

....
     public abstract Class<Owner extends Payload>[] payload() default {};
....
}


Top
 Profile  
 
 Post subject: Re: What is a payload parameter
PostPosted: Wed Oct 07, 2009 4:55 am 
Newbie

Joined: Thu Aug 27, 2009 8:21 am
Posts: 13
Sorry, my fault for not reading your exception properly. I had assumed that you were writing your own constraint annotations, which is when this problem most frequently occurs (apparently the documented example code is out of date and this line is missing from it -- it's needed in each custom annotation). The code I posted is intended to sit in such an annotation.

What versions of the api and validator are you using?


Top
 Profile  
 
 Post subject: Re: What is a payload parameter
PostPosted: Thu Oct 08, 2009 12:19 am 
Regular
Regular

Joined: Tue Feb 17, 2009 3:36 pm
Posts: 78
bryan.dollery wrote:
Sorry, my fault for not reading your exception properly. I had assumed that you were writing your own constraint annotations, which is when this problem most frequently occurs (apparently the documented example code is out of date and this line is missing from it -- it's needed in each custom annotation). The code I posted is intended to sit in such an annotation.

What versions of the api and validator are you using?


The 4.0 version as the org.hibernate.validation package indicates.


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