}
private static void bindFetchProfileAnnotations(MetadataImpl meta, List<AnnotationInstance> fetchProfileAnnotations) {
for ( AnnotationInstance fetchProfileAnnotation : fetchProfileAnnotations ) {
String name = fetchProfileAnnotation.value( "name" ).asString();
FetchProfile profile = meta.findOrCreateFetchProfile( name, MetadataSource.ANNOTATIONS );
AnnotationInstance overrides[] = fetchProfileAnnotation.value( "fetchOverrides" ).asNestedArray();
for ( AnnotationInstance overrideAnnotation : overrides ) {
FetchMode fetchMode = Enum.valueOf( FetchMode.class, overrideAnnotation.value( "mode" ).asEnum() );
if ( !fetchMode.equals( org.hibernate.annotations.FetchMode.JOIN ) ) {
throw new MappingException( "Only FetchMode.JOIN is currently supported" );
}
String entityClassName = overrideAnnotation.value( "entity" ).asClass().name().toString();
String associationName = overrideAnnotation.value( "association" ).asString();
profile.addFetch(
entityClassName, associationName, fetchMode.toString().toLowerCase()
);
}
}
}