public void doSecondPass(Map persistentClasses) throws MappingException { org.hibernate.mapping.FetchProfile profile = buildingContext.getMetadataCollector().getFetchProfile( fetchProfileName ); if ( profile != null ) { if ( profile.getSource() != MetadataSource.ANNOTATIONS ) { return; } } else { profile = new org.hibernate.mapping.FetchProfile( fetchProfileName, MetadataSource.ANNOTATIONS ); buildingContext.getMetadataCollector().addFetchProfile( profile ); } PersistentClass clazz = buildingContext.getMetadataCollector().getEntityBinding( fetch.entity().getName() ); // throws MappingException in case the property does not exist clazz.getProperty( fetch.association() ); profile.addFetch( fetch.entity().getName(), fetch.association(), fetch.mode().toString().toLowerCase(Locale.ROOT) ); } }
public void doSecondPass(Map persistentClasses) throws MappingException { org.hibernate.mapping.FetchProfile profile = mappings.findOrCreateFetchProfile( fetchProfileName ); if ( skipProfile( profile ) ) { return; } PersistentClass clazz = mappings.getClass( fetch.entity().getName() ); // throws MappingException in case the property does not exist clazz.getProperty( fetch.association() ); profile.addFetch( fetch.entity().getName(), fetch.association(), fetch.mode().toString().toLowerCase() ); }
public void doSecondPass(Map persistentClasses) throws MappingException { org.hibernate.mapping.FetchProfile profile = mappings.findOrCreateFetchProfile( fetchProfileName, MetadataSource.ANNOTATIONS ); if ( MetadataSource.ANNOTATIONS != profile.getSource() ) { return; } PersistentClass clazz = mappings.getClass( fetch.entity().getName() ); // throws MappingException in case the property does not exist clazz.getProperty( fetch.association() ); profile.addFetch( fetch.entity().getName(), fetch.association(), fetch.mode().toString().toLowerCase() ); } }
public void doSecondPass(Map persistentClasses) throws MappingException { org.hibernate.mapping.FetchProfile profile = mappings.findOrCreateFetchProfile( fetchProfileName, MetadataSource.ANNOTATIONS ); if ( MetadataSource.ANNOTATIONS != profile.getSource() ) { return; } PersistentClass clazz = mappings.getClass( fetch.entity().getName() ); // throws MappingException in case the property does not exist clazz.getProperty( fetch.association() ); profile.addFetch( fetch.entity().getName(), fetch.association(), fetch.mode().toString().toLowerCase() ); } }
private static void bind(MetadataImplementor metadata, AnnotationInstance fetchProfile) { String name = JandexHelper.getValue( fetchProfile, "name", String.class ); Set<Fetch> fetches = new HashSet<Fetch>(); AnnotationInstance[] overrideAnnotations = JandexHelper.getValue( fetchProfile, "fetchOverrides", AnnotationInstance[].class ); for ( AnnotationInstance override : overrideAnnotations ) { FetchMode fetchMode = JandexHelper.getEnumValue( override, "mode", FetchMode.class ); if ( !fetchMode.equals( org.hibernate.annotations.FetchMode.JOIN ) ) { throw new MappingException( "Only FetchMode.JOIN is currently supported" ); } final String entityName = JandexHelper.getValue( override, "entity", String.class ); final String associationName = JandexHelper.getValue( override, "association", String.class ); fetches.add( new Fetch( entityName, associationName, fetchMode.toString().toLowerCase() ) ); } metadata.addFetchProfile( new FetchProfile( name, fetches ) ); } }
private static void bind(MetadataImplementor metadata, AnnotationInstance fetchProfile) { String name = JandexHelper.getValue( fetchProfile, "name", String.class ); Set<Fetch> fetches = new HashSet<Fetch>(); AnnotationInstance[] overrideAnnotations = JandexHelper.getValue( fetchProfile, "fetchOverrides", AnnotationInstance[].class ); for ( AnnotationInstance override : overrideAnnotations ) { FetchMode fetchMode = JandexHelper.getEnumValue( override, "mode", FetchMode.class ); if ( !fetchMode.equals( org.hibernate.annotations.FetchMode.JOIN ) ) { throw new MappingException( "Only FetchMode.JOIN is currently supported" ); } final String entityName = JandexHelper.getValue( override, "entity", String.class ); final String associationName = JandexHelper.getValue( override, "association", String.class ); fetches.add( new Fetch( entityName, associationName, fetchMode.toString().toLowerCase() ) ); } metadata.addFetchProfile( new FetchProfile( name, fetches ) ); } }
public void doSecondPass(Map persistentClasses) throws MappingException { org.hibernate.mapping.FetchProfile profile = buildingContext.getMetadataCollector().getFetchProfile( fetchProfileName ); if ( profile != null ) { if ( profile.getSource() != MetadataSource.ANNOTATIONS ) { return; } } else { profile = new org.hibernate.mapping.FetchProfile( fetchProfileName, MetadataSource.ANNOTATIONS ); buildingContext.getMetadataCollector().addFetchProfile( profile ); } PersistentClass clazz = buildingContext.getMetadataCollector().getEntityBinding( fetch.entity().getName() ); // throws MappingException in case the property does not exist clazz.getProperty( fetch.association() ); profile.addFetch( fetch.entity().getName(), fetch.association(), fetch.mode().toString().toLowerCase(Locale.ROOT) ); } }