-->
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.  [ 1 post ] 
Author Message
 Post subject: Hibernate validator unable to invoke getter method
PostPosted: Thu Oct 09, 2008 8:48 am 
Newbie

Joined: Thu Oct 09, 2008 8:28 am
Posts: 1
Hello,

I am trying to work with package visibility Entity classes (why I do this is out of the scope of this post, but I can answer any questions if you're curious)

Note: the JSR220 - section 2.1 does not state that being a public class is a requirement of the Entity classes.


I have a @NotNull hibernate annotation on a given getter method.

I am facing an issue in Hibernate Validator:

As of Hibernate Validator 3.0.0.GA the method
org.hibernate.validator.ClassValidator.setAccessible(XMember member)
looks like:


private static void setAccessible(XMember member) {
if ( !Modifier.isPublic( member.getModifiers() ) ) {
member.setAccessible( true );
}
}


The issue is that my getter method is public, so that setAccessible(true) is never called, while the package visibility of the Entity class prevents calling the method, so that I get an IllegalAccessException.


If I change the getter method to package-visibility (i.e. remove public) the validator works fine.

Shouldn't the code above check for actual accessibility instead of looking at the modifiers?


Thanks in advance
Best regards
Jan


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.