mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-06 19:36:03 +00:00
METAGEN-79 TestUtil#getFieldFromMetamodelFor() used now Class.getDeclaredField() to only access fields defined in the actual class
This commit is contained in:
parent
2d245a3798
commit
4ac9cbfdb3
@ -42,10 +42,16 @@ public void testInheritance() throws Exception {
|
||||
|
||||
// METAGEN-29
|
||||
assertSuperClassRelationShipInMetamodel( Person.class, AbstractEntity.class );
|
||||
assertPresenceOfFieldInMetamodelFor( AbstractEntity.class, "id", "Property 'id' should exist" );
|
||||
assertPresenceOfFieldInMetamodelFor( AbstractEntity.class, "foo", "Property should exist - METAGEN-29" );
|
||||
assertAttributeTypeInMetaModelFor(
|
||||
AbstractEntity.class, "foo", Object.class, "Object is the upper bound of foo "
|
||||
AbstractEntity.class,
|
||||
"foo",
|
||||
Object.class,
|
||||
"Object is the upper bound of foo "
|
||||
);
|
||||
|
||||
assertPresenceOfFieldInMetamodelFor( Person.class, "name", "Property 'name' should exist" );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -211,7 +211,7 @@ public static Field getFieldFromMetamodelFor(Class<?> entityClass, String fieldN
|
||||
Class<?> metaModelClass = getMetamodelClassFor( entityClass );
|
||||
Field field;
|
||||
try {
|
||||
field = metaModelClass.getField( fieldName );
|
||||
field = metaModelClass.getDeclaredField( fieldName );
|
||||
}
|
||||
catch ( NoSuchFieldException e ) {
|
||||
field = null;
|
||||
|
Loading…
x
Reference in New Issue
Block a user