Package org.hibernate.annotations

Examples of org.hibernate.annotations.FetchMode


        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 ) );
  }
View Full Code Here


      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()
        );
      }
    }
  }
View Full Code Here

  private static void bind(MetadataImplementor metadata, AnnotationInstance fetchProfile) {
    String name = JandexHelper.getValueAsString( fetchProfile, "name" );
    Set<Fetch> fetches = new HashSet<Fetch>();
    for ( AnnotationInstance override : JandexHelper.getValueAsArray( fetchProfile, "fetchOverrides" ) ) {
      FetchMode fetchMode = JandexHelper.getValueAsEnum( override, "mode", FetchMode.class );
      if ( !fetchMode.equals( org.hibernate.annotations.FetchMode.JOIN ) ) {
        throw new MappingException( "Only FetchMode.JOIN is currently supported" );
      }
      fetches.add(
          new Fetch(
              JandexHelper.getValueAsString( override, "entity" ), JandexHelper.getValueAsString(
                  override,
                  "association"
              ),
              fetchMode.toString().toLowerCase()
          )
      );
    }
    metadata.addFetchProfile( new FetchProfile( name, fetches ) );
  }
View Full Code Here

        fetchProfile,
        "fetchOverrides",
        AnnotationInstance[].class
    );
    for ( AnnotationInstance override : overrideAnnotations ) {
      FetchMode fetchMode = JandexHelper.getValueAsEnum( 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 ) );
  }
View Full Code Here

        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 ) );
  }
View Full Code Here

TOP

Related Classes of org.hibernate.annotations.FetchMode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.