HHH-5334 Fixed bug in MetaDataCache.findMember

git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@19917 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
Hardy Ferentschik 2010-07-08 09:49:37 +00:00
parent d40d1edb09
commit cb2993cfbb
2 changed files with 16 additions and 10 deletions

View File

@ -192,7 +192,7 @@ public class PersistenceUtilHelper {
return field;
}
catch ( NoSuchFieldException e ) {
final Method method = getMethod( clazz, property );
final Method method = getMethod( current, property );
if (method != null) {
setAccessibility( method );
return method;

View File

@ -28,28 +28,26 @@ import javax.persistence.spi.LoadState;
import org.hibernate.ejb.util.PersistenceUtilHelper;
/**
* Tests for HHH-5094
* Tests for HHH-5094 and HHH-5334
*
* @author Hardy Ferentschik
*/
public class PersistenceUtilHelperTest extends junit.framework.TestCase {
private final PersistenceUtilHelper.MetadataCache cache = new PersistenceUtilHelper.MetadataCache();
public static class FieldAccessBean {
public String publicAccessProperty;
public static class FieldAccessBean extends FieldAccessBeanBase {
protected String protectedAccessProperty;
private String privateAccessProperty;
}
public static class MethodAccessBean {
private String publicAccessProperty;
public static class FieldAccessBeanBase {
public String publicAccessProperty;
}
public static class MethodAccessBean extends MethodAccessBeanBase {
private String protectedAccessProperty;
private String privateAccessProperty;
public String getPublicAccessPropertyValue() {
return publicAccessProperty;
}
protected String getProtectedAccessPropertyValue() {
return protectedAccessProperty;
}
@ -59,6 +57,14 @@ public class PersistenceUtilHelperTest extends junit.framework.TestCase {
}
}
public static class MethodAccessBeanBase {
private String publicAccessProperty;
public String getPublicAccessPropertyValue() {
return publicAccessProperty;
}
}
public void testIsLoadedWithReferencePublicField() {
assertEquals(
LoadState.UNKNOWN,