@Test public void testSingleFetchProfile() { @FetchProfile(name = "foo", fetchOverrides = { @FetchProfile.FetchOverride(entity = Foo.class, association = "bar", mode = FetchMode.JOIN) }) class Foo { } Index index = JandexHelper.indexForClass( service, Foo.class ); FetchProfileBinder.bind( new AnnotationBindingContextImpl( meta, index ) ); Iterator<org.hibernate.metamodel.binding.FetchProfile> mappedFetchProfiles = meta.getFetchProfiles().iterator(); assertTrue( mappedFetchProfiles.hasNext() ); org.hibernate.metamodel.binding.FetchProfile profile = mappedFetchProfiles.next(); assertEquals( "Wrong fetch profile name", "foo", profile.getName() ); org.hibernate.metamodel.binding.FetchProfile.Fetch fetch = profile.getFetches().iterator().next(); assertEquals( "Wrong association name", "bar", fetch.getAssociation() ); assertEquals( "Wrong association type", Foo.class.getName(), fetch.getEntity() ); }
public static void bind(AnnotationBindingContext bindingContext) { List<AnnotationInstance> annotations = bindingContext.getIndex() .getAnnotations( HibernateDotNames.FETCH_PROFILE ); for ( AnnotationInstance fetchProfile : annotations ) { bind( bindingContext.getMetadataImplementor(), fetchProfile ); } annotations = bindingContext.getIndex().getAnnotations( HibernateDotNames.FETCH_PROFILES ); for ( AnnotationInstance fetchProfiles : annotations ) { AnnotationInstance[] fetchProfileAnnotations = JandexHelper.getValue( fetchProfiles, "value", AnnotationInstance[].class ); for ( AnnotationInstance fetchProfile : fetchProfileAnnotations ) { bind( bindingContext.getMetadataImplementor(), fetchProfile ); } } }
FetchProfileBinder { public static void bind(AnnotationBindingContext bindingContext) { List<AnnotationInstance> annotations = bindingContext.getIndex() .getAnnotations( HibernateDotNames.FETCH_PROFILE ); for ( AnnotationInstance fetchProfile : annotations ) { bind( bindingContext.getMetadataImplementor(), fetchProfile ); } annotations = bindingContext.getIndex().getAnnotations( HibernateDotNames.FETCH_PROFILES ); for ( AnnotationInstance fetchProfiles : annotations ) { AnnotationInstance[] fetchProfileAnnotations = JandexHelper.getValue( fetchProfiles, "value", AnnotationInstance[].class ); for ( AnnotationInstance fetchProfile : fetchProfileAnnotations ) { bind( bindingContext.getMetadataImplementor(), fetchProfile ); } } } }
FetchProfileBinder { public static void bind(AnnotationBindingContext bindingContext) { List<AnnotationInstance> annotations = bindingContext.getIndex() .getAnnotations( HibernateDotNames.FETCH_PROFILE ); for ( AnnotationInstance fetchProfile : annotations ) { bind( bindingContext.getMetadataImplementor(), fetchProfile ); } annotations = bindingContext.getIndex().getAnnotations( HibernateDotNames.FETCH_PROFILES ); for ( AnnotationInstance fetchProfiles : annotations ) { AnnotationInstance[] fetchProfileAnnotations = JandexHelper.getValue( fetchProfiles, "value", AnnotationInstance[].class ); for ( AnnotationInstance fetchProfile : fetchProfileAnnotations ) { bind( bindingContext.getMetadataImplementor(), fetchProfile ); } } } private  FetchProfileBinder(); }
FetchProfileBinder { public static void bind(AnnotationBindingContext bindingContext) { List<AnnotationInstance> annotations = bindingContext.getIndex() .getAnnotations( HibernateDotNames.FETCH_PROFILE ); for ( AnnotationInstance fetchProfile : annotations ) { bind( bindingContext.getMetadataImplementor(), fetchProfile ); } annotations = bindingContext.getIndex().getAnnotations( HibernateDotNames.FETCH_PROFILES ); for ( AnnotationInstance fetchProfiles : annotations ) { AnnotationInstance[] fetchProfileAnnotations = JandexHelper.getValue( fetchProfiles, "value", AnnotationInstance[].class ); for ( AnnotationInstance fetchProfile : fetchProfileAnnotations ) { bind( bindingContext.getMetadataImplementor(), fetchProfile ); } } } private  FetchProfileBinder(); static void bind(AnnotationBindingContext bindingContext); }
FetchProfileBinder { public static void bind(AnnotationBindingContext bindingContext) { List<AnnotationInstance> annotations = bindingContext.getIndex() .getAnnotations( HibernateDotNames.FETCH_PROFILE ); for ( AnnotationInstance fetchProfile : annotations ) { bind( bindingContext.getMetadataImplementor(), fetchProfile ); } annotations = bindingContext.getIndex().getAnnotations( HibernateDotNames.FETCH_PROFILES ); for ( AnnotationInstance fetchProfiles : annotations ) { AnnotationInstance[] fetchProfileAnnotations = JandexHelper.getValue( fetchProfiles, "value", AnnotationInstance[].class ); for ( AnnotationInstance fetchProfile : fetchProfileAnnotations ) { bind( bindingContext.getMetadataImplementor(), fetchProfile ); } } } private  FetchProfileBinder(); static void bind(AnnotationBindingContext bindingContext);  }