[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-5334) PersistenceUtilHelpe.findMember(Class, String) private method doesn't work with members of a superclass

Valentino Proietti (JIRA) noreply at atlassian.com
Thu Jun 24 03:57:09 EDT 2010


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-5334?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=37557#action_37557 ] 

Valentino Proietti commented on HHH-5334:
-----------------------------------------

No, I don't have a specific one and I don't really think it is needed in this case since if you take a look at the code it is clear where the problem is.
Anyway, this is part of the exception raised using the Hibernate 3.5.3 version (with Hibernate 3.5.2 everything is ok):

javax.persistence.PersistenceException: Unable to find field or method: class net.infordata.tdoc.jpa.dyna.Repository#id
	at org.hibernate.ejb.util.PersistenceUtilHelper$MetadataCache.findMember(PersistenceUtilHelper.java:203)
	at org.hibernate.ejb.util.PersistenceUtilHelper$MetadataCache.getMember(PersistenceUtilHelper.java:178)
	at org.hibernate.ejb.util.PersistenceUtilHelper.get(PersistenceUtilHelper.java:91)
	at org.hibernate.ejb.util.PersistenceUtilHelper.isLoadedWithReference(PersistenceUtilHelper.java:83)
	at org.hibernate.ejb.HibernatePersistence$1.isLoadedWithReference(HibernatePersistence.java:93)
	at javax.persistence.Persistence$1.isLoaded(Persistence.java:83)
	at org.hibernate.validator.engine.resolver.JPATraversableResolver.isReachable(JPATraversableResolver.java:33)
	at org.hibernate.validator.engine.resolver.DefaultTraversableResolver.isReachable(DefaultTraversableResolver.java:112)
	at org.hibernate.validator.engine.resolver.SingleThreadCachedTraversableResolver.isReachable(SingleThreadCachedTraversableResolver.java:47)
	at org.hibernate.validator.engine.ValidatorImpl.isValidationRequired(ValidatorImpl.java:764)
	at org.hibernate.validator.engine.ValidatorImpl.validateConstraint(ValidatorImpl.java:331)
	at org.hibernate.validator.engine.ValidatorImpl.validateConstraintsForRedefinedDefaultGroup(ValidatorImpl.java:278)
	at org.hibernate.validator.engine.ValidatorImpl.validateConstraintsForCurrentGroup(ValidatorImpl.java:260)
	at org.hibernate.validator.engine.ValidatorImpl.validateInContext(ValidatorImpl.java:213)
	at org.hibernate.validator.engine.ValidatorImpl.validate(ValidatorImpl.java:119)
    ...
	
Thank you

> PersistenceUtilHelpe.findMember(Class, String) private method doesn't work with members of a superclass
> -------------------------------------------------------------------------------------------------------
>
>                 Key: HHH-5334
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5334
>             Project: Hibernate Core
>          Issue Type: Bug
>    Affects Versions: 3.5.3
>            Reporter: Valentino Proietti
>
> It is clear to me that the line:
> final Method method = getMethod( clazz, property );
> should be replaced with:
> final Method method = getMethod( current, property );
> Thanks
> private Member findMember(Class<?> clazz, String property) {
> 	final List<Class<?>> classes = getClassHierarchy( clazz );
> 	for (Class current : classes) {
> 		final Field field;
> 		try {
> 			field = current.getDeclaredField( property );
> 			setAccessibility( field );
> 			return field;
> 		}
> 		catch ( NoSuchFieldException e ) {
> 			final Method method = getMethod( clazz, property );
> 			if (method != null) {
> 				setAccessibility( method );
> 				return method;
> 			}
> 		}
> 	}
> 	//we could not find any match
> 	throw new PersistenceException( "Unable to find field or method: "
> 					+ clazz + "#"
> 					+ property);
> }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list