-->
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.  [ 4 posts ] 
Author Message
 Post subject: ClassValidator missing embedded members during schema create
PostPosted: Tue Apr 29, 2008 4:57 am 
Newbie

Joined: Fri Oct 06, 2006 8:09 pm
Posts: 5
Location: Costa Mesa, CA
During schema generation using AnnotationConfiguration, the ClassValidator is skipping members of embedded components with custom @ValidatorClass annotations.

There is a fairly easy change to ClassValidator.createMemberValidator() to check if the memberAnnotation is a Embedded, then recursively add the embedded members to the memberValidators and memberGetters collections (of ClassValidator).

Unfortunately, the BinderHelper.findPropertyByName method (3.2.1.ga) and the ClassValidator.findPropertyByName method (latest version) don't recursively find the actual property/member, and thus ClassValidator.apply() skips applying the property validation on embedded attributes.

Any suggestions regarding a workaround for 3.2.1.GA of annotations, or the prospect this will be fixed in a future release.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 29, 2008 6:11 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Hi,
did you try using
Quote:
@Valid
?
This should instruct the framework to recursively test validation on referenced objects,
I didn't try it on embedded components but it should work.

regards,

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 29, 2008 4:33 pm 
Newbie

Joined: Fri Oct 06, 2006 8:09 pm
Posts: 5
Location: Costa Mesa, CA
Sanne - Thanks for the reply.

@Valid did not work for embedded attributes. However, if I put my custom validation check annotation on the embedded attribute itself, my validator class is called. Via iterating columns on the property's value attribute, I was able to add the check constraint to each of the embedded class' attributes.

Unfortunately, within the PropertyConstraint.apply() method, I only have access to the property and its 'value", and can't seem to get access to any of the member annotations. Thus, this approach only works if all enbedded component members need this check constraint.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 04, 2008 9:27 pm 
Newbie

Joined: Fri Oct 05, 2007 8:50 am
Posts: 2
This appears to be related to the topic

[url]http://forum.hibernate.org/viewtopic.php?t=975612&highlight=
[/url]

There is a bug report covering this (HV-25). Voting for the bug may increase the likelihood of it being fixed.


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