Package org.hibernate.annotations.common.reflection

Examples of org.hibernate.annotations.common.reflection.XProperty


          "@IdClass class should not have @Id nor @EmbeddedId properties: "
              + BinderHelper.getPath( propertyHolder, inferredData )
      );
    }
    XClass returnedClass = inferredData.getClassOrElement();
    XProperty property = inferredData.getProperty();
    //clone classGenerator and override with local values
    HashMap<String, IdGenerator> localGenerators = ( HashMap<String, IdGenerator> ) classGenerators.clone();
    localGenerators.putAll( buildLocalGenerators( property, mappings ) );

    //manage composite related metadata
    //guess if its a component and find id data access (property, field etc)
    final boolean isComponent = returnedClass.isAnnotationPresent( Embeddable.class )
        || property.isAnnotationPresent( EmbeddedId.class );

    GeneratedValue generatedValue = property.getAnnotation( GeneratedValue.class );
    String generatorType = generatedValue != null ?
        generatorType( generatedValue.strategy(), mappings ) :
        "assigned";
    String generatorName = generatedValue != null ?
        generatedValue.generator() :
View Full Code Here


                + " has no persistent id property: "
                + BinderHelper.getPath( propertyHolder, inferredData )
        );
      }
    }
    XProperty property = inferredData.getProperty();
    setupComponentTuplizer( property, comp );
    PropertyBinder binder = new PropertyBinder();
    binder.setName( inferredData.getPropertyName() );
    binder.setValue( comp );
    binder.setProperty( inferredData.getProperty() );
View Full Code Here

          propertyAnnotatedElement,
          new HashMap<String, IdGenerator>(), entityBinder, isIdentifierMapper, isComponentEmbedded,
          inSecondPass, mappings, inheritanceStatePerClass
      );

      XProperty property = propertyAnnotatedElement.getProperty();
      if ( property.isAnnotationPresent( GeneratedValue.class ) &&
          property.isAnnotationPresent( Id.class ) ) {
        //clone classGenerator and override with local values
        Map<String, IdGenerator> localGenerators = new HashMap<String, IdGenerator>();
        localGenerators.putAll( buildLocalGenerators( property, mappings ) );

        GeneratedValue generatedValue = property.getAnnotation( GeneratedValue.class );
        String generatorType = generatedValue != null ? generatorType(
            generatedValue.strategy(), mappings
        ) : "assigned";
        String generator = generatedValue != null ? generatedValue.generator() : BinderHelper.ANNOTATION_STRING_DEFAULT;

        BinderHelper.makeIdGenerator(
            ( SimpleValue ) comp.getProperty( property.getName() ).getValue(),
            generatorType,
            generator,
            mappings,
            localGenerators
        );
View Full Code Here

      }
      if ( componentId.getPropertySpan() == 0 ) {
        throw new AnnotationException( componentId.getComponentClassName() + " has no persistent id property" );
      }
      //tuplizers
      XProperty property = inferredData.getProperty();
      setupComponentTuplizer( property, componentId );
    }
    else {
      //TODO I think this branch is never used. Remove.
View Full Code Here

    // This is a @OneToOne mapped to a physical o.h.mapping.ManyToOne
    if ( unique ) {
      value.markAsLogicalOneToOne();
    }
    value.setReferencedEntityName( ToOneBinder.getReferenceEntityName( inferredData, targetEntity, mappings ) );
    final XProperty property = inferredData.getProperty();
    defineFetchingStrategy( value, property );
    //value.setFetchMode( fetchMode );
    value.setIgnoreNotFound( ignoreNotFound );
    value.setCascadeDeleteEnabled( cascadeOnDelete );
    //value.setLazy( fetchMode != FetchMode.JOIN );
    if ( !optional ) {
      for ( Ejb3JoinColumn column : columns ) {
        column.setNullable( false );
      }
    }
    if ( property.isAnnotationPresent( MapsId.class ) ) {
      //read only
      for ( Ejb3JoinColumn column : columns ) {
        column.setInsertable( false );
        column.setUpdatable( false );
      }
    }

    //Make sure that JPA1 key-many-to-one columns are read only tooj
    boolean hasSpecjManyToOne=false;
    if ( mappings.isSpecjProprietarySyntaxEnabled() ) {
      String columnName = "";
      for ( XProperty prop : inferredData.getDeclaringClass()
          .getDeclaredProperties( AccessType.FIELD.getType() ) ) {
        if ( prop.isAnnotationPresent( Id.class ) && prop.isAnnotationPresent( Column.class ) ) {
          columnName = prop.getAnnotation( Column.class ).name();
        }

        final JoinColumn joinColumn = property.getAnnotation( JoinColumn.class );
        if ( property.isAnnotationPresent( ManyToOne.class ) && joinColumn != null
            && ! BinderHelper.isEmptyAnnotationValue( joinColumn.name() )
            && joinColumn.name().equals( columnName )
            && !property.isAnnotationPresent( MapsId.class ) ) {
           hasSpecjManyToOne = true;
          for ( Ejb3JoinColumn column : columns ) {
            column.setInsertable( false );
            column.setUpdatable( false );
          }
        }
      }

    }
    value.setTypeName( inferredData.getClassOrElementName() );
    final String propertyName = inferredData.getPropertyName();
    value.setTypeUsingReflection( propertyHolder.getClassName(), propertyName );

    ForeignKey fk = property.getAnnotation( ForeignKey.class );
    String fkName = fk != null ?
        fk.name() :
        "";
    if ( !BinderHelper.isEmptyAnnotationValue( fkName ) ) {
      value.setForeignKeyName( fkName );
View Full Code Here

  public ComponentPropertyHolder(
      Component component, String path, PropertyData inferredData, PropertyHolder parent,
      ExtendedMappings mappings
  ) {
    super( path, parent, inferredData.getPropertyClass(), mappings );
    final XProperty property = inferredData.getProperty();
    setCurrentProperty( property );
    this.component = component;
    this.isOrWithinEmbeddedId =
        parent.isOrWithinEmbeddedId()
        || ( property != null &&
          ( property.isAnnotationPresent( Id.class )
          || property.isAnnotationPresent( EmbeddedId.class ) ) );
  }
View Full Code Here

          "@IdClass class should not have @Id nor @EmbeddedId properties: "
              + BinderHelper.getPath( propertyHolder, inferredData )
      );
    }
    XClass returnedClass = inferredData.getClassOrElement();
    XProperty property = inferredData.getProperty();
    //clone classGenerator and override with local values
    HashMap<String, IdGenerator> localGenerators = (HashMap<String, IdGenerator>) classGenerators.clone();
    localGenerators.putAll( buildLocalGenerators( property, mappings ) );

    //manage composite related metadata
    //guess if its a component and find id data access (property, field etc)
    final boolean isComponent = returnedClass.isAnnotationPresent( Embeddable.class )
        || property.isAnnotationPresent( EmbeddedId.class );

    GeneratedValue generatedValue = property.getAnnotation( GeneratedValue.class );
    String generatorType = generatedValue != null ?
        generatorType( generatedValue.strategy(), mappings ) :
        "assigned";
    String generatorName = generatedValue != null ?
        generatedValue.generator() :
View Full Code Here

        throw new AnnotationException( comp.getComponentClassName()
            + " has no persistent id property: "
            + BinderHelper.getPath( propertyHolder, inferredData ) );
      }
    }
    XProperty property = inferredData.getProperty();
    setupComponentTuplizer( property, comp );
    PropertyBinder binder = new PropertyBinder();
    binder.setName( inferredData.getPropertyName() );
    binder.setValue( comp );
    binder.setProperty( inferredData.getProperty() );
View Full Code Here

          propertyAnnotatedElement,
          new HashMap<String, IdGenerator>(), entityBinder, isIdentifierMapper, isComponentEmbedded,
          inSecondPass, mappings, inheritanceStatePerClass
      );
     
      XProperty property = propertyAnnotatedElement.getProperty();
      if(property.isAnnotationPresent(GeneratedValue.class) &&
            property.isAnnotationPresent(Id.class) ) {
         //clone classGenerator and override with local values
         Map<String, IdGenerator> localGenerators = new HashMap<String, IdGenerator>();
         localGenerators.putAll( buildLocalGenerators( property, mappings ) );

         GeneratedValue generatedValue = property.getAnnotation( GeneratedValue.class );
         String generatorType = generatedValue != null ? generatorType( generatedValue.strategy(), mappings ) : "assigned";
         String generator = generatedValue != null ? generatedValue.generator() : BinderHelper.ANNOTATION_STRING_DEFAULT;
                  
         BinderHelper.makeIdGenerator( (SimpleValue) comp.getProperty(property.getName()).getValue(), generatorType, generator, mappings, localGenerators);
      }

    }
    return comp;
  }
View Full Code Here

      }
      if ( componentId.getPropertySpan() == 0 ) {
        throw new AnnotationException( componentId.getComponentClassName() + " has no persistent id property" );
      }
      //tuplizers
      XProperty property = inferredData.getProperty();
      setupComponentTuplizer( property, componentId );
    }
    else {
      //TODO I think this branch is never used. Remove.
View Full Code Here

TOP

Related Classes of org.hibernate.annotations.common.reflection.XProperty

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.