Package org.hibernate.cfg

Examples of org.hibernate.cfg.PropertyData


            throw new AssertionFailure( "Unable to guess collection property accessor name" );
          }

          //boolean propertyAccess = embeddable == null || AccessType.PROPERTY.equals( embeddable.access() );
          //FIXME "index" is it right?
          PropertyData inferredData = new PropertyPreloadedData( "property", "index", elementClass );
          //TODO be smart with isNullable
          Component component = AnnotationBinder.fillComponent(
              holder, inferredData, isPropertyAnnotated, isPropertyAnnotated ? "property" : "field", true,
              entityBinder, false, false,
              true, mappings
View Full Code Here


    );
    CollectionId collectionIdAnn = property.getAnnotation( CollectionId.class );
    if (collectionIdAnn != null) {
      SimpleValueBinder simpleValue = new SimpleValueBinder();

      PropertyData propertyData = new WrappedInferredData(
          new PropertyInferredData(property, null, //default access should not be useful
              mappings.getReflectionManager() ),
          "id" );
      Ejb3Column[] idColumns = Ejb3Column.buildColumnFromAnnotation(
          collectionIdAnn.columns(),
View Full Code Here

      if ( !BinderHelper.isEmptyAnnotationValue( fkName ) ) element.setForeignKeyName( fkName );
    }
    else if ( anyAnn != null ) {
      //@ManyToAny
      //Make sure that collTyp is never used during the @ManyToAny branch: it will be set to void.class
      PropertyData inferredData = new PropertyInferredData(null, property, "unsupported", mappings.getReflectionManager() );
      //override the table
      for (Ejb3Column column : inverseJoinColumns) {
        column.setTable( collValue.getCollectionTable() );
      }
      Any any = BinderHelper.buildAnyValue( anyAnn.metaDef(), inverseJoinColumns, anyAnn.metaColumn(),
          inferredData, cascadeDeleteEnabled, Nullability.NO_CONSTRAINT,
          propertyHolder, new EntityBinder(), true, mappings );
      collValue.setElement( any );
    }
    else {
      XClass elementClass;
      AnnotatedClassType classType;

      PropertyHolder holder = null;
      if ( BinderHelper.PRIMITIVE_NAMES.contains( collType.getName() ) ) {
        classType = AnnotatedClassType.NONE;
        elementClass = null;
      }
      else {
        elementClass = collType;
        classType = mappings.getClassType( elementClass );

        holder = PropertyHolderBuilder.buildPropertyHolder(
            collValue,
            collValue.getRole(),
            elementClass,
            property, parentPropertyHolder, mappings
        );
        //force in case of attribute override
        boolean attributeOverride = property.isAnnotationPresent( AttributeOverride.class )
            || property.isAnnotationPresent( AttributeOverrides.class );
        if ( isEmbedded || attributeOverride ) {
          classType = AnnotatedClassType.EMBEDDABLE;
        }
      }

      if ( AnnotatedClassType.EMBEDDABLE.equals( classType ) ) {
        EntityBinder entityBinder = new EntityBinder();
        PersistentClass owner = collValue.getOwner();
        boolean isPropertyAnnotated;
        //FIXME support @Access for collection of elements
        //String accessType = access != null ? access.value() : null;
        if ( owner.getIdentifierProperty() != null ) {
          isPropertyAnnotated = owner.getIdentifierProperty().getPropertyAccessorName().equals( "property" );
        }
        else if ( owner.getIdentifierMapper() != null && owner.getIdentifierMapper().getPropertySpan() > 0 ) {
          Property prop = (Property) owner.getIdentifierMapper().getPropertyIterator().next();
          isPropertyAnnotated = prop.getPropertyAccessorName().equals( "property" );
        }
        else {
          throw new AssertionFailure( "Unable to guess collection property accessor name" );
        }

        PropertyData inferredData;
        if ( isMap() ) {
          //"value" is the JPA 2 prefix for map values (used to be "element")
          if ( isHibernateExtensionMapping() ) {
            inferredData = new PropertyPreloadedData( AccessType.PROPERTY, "element", elementClass );
          }
View Full Code Here

      if ( !BinderHelper.isEmptyAnnotationValue( fkName ) ) element.setForeignKeyName( fkName );
    }
    else if ( anyAnn != null ) {
      //@ManyToAny
      //Make sure that collTyp is never used during the @ManyToAny branch: it will be set to void.class
      PropertyData inferredData = new PropertyInferredData(null, property, "unsupported", mappings.getReflectionManager() );
      //override the table
      for (Ejb3Column column : inverseJoinColumns) {
        column.setTable( collValue.getCollectionTable() );
      }
      Any any = BinderHelper.buildAnyValue( anyAnn.metaDef(), inverseJoinColumns, anyAnn.metaColumn(),
          inferredData, cascadeDeleteEnabled, Nullability.NO_CONSTRAINT,
          propertyHolder, new EntityBinder(), true, mappings );
      collValue.setElement( any );
    }
    else {
      XClass elementClass;
      AnnotatedClassType classType;

      PropertyHolder holder = null;
      if ( BinderHelper.PRIMITIVE_NAMES.contains( collType.getName() ) ) {
        classType = AnnotatedClassType.NONE;
        elementClass = null;
      }
      else {
        elementClass = collType;
        classType = mappings.getClassType( elementClass );

        holder = PropertyHolderBuilder.buildPropertyHolder(
            collValue,
            collValue.getRole(),
            elementClass,
            property, parentPropertyHolder, mappings
        );
        //force in case of attribute override
        boolean attributeOverride = property.isAnnotationPresent( AttributeOverride.class )
            || property.isAnnotationPresent( AttributeOverrides.class );
        if ( isEmbedded || attributeOverride ) {
          classType = AnnotatedClassType.EMBEDDABLE;
        }
      }

      if ( AnnotatedClassType.EMBEDDABLE.equals( classType ) ) {
        EntityBinder entityBinder = new EntityBinder();
        PersistentClass owner = collValue.getOwner();
        boolean isPropertyAnnotated;
        //FIXME support @Access for collection of elements
        //String accessType = access != null ? access.value() : null;
        if ( owner.getIdentifierProperty() != null ) {
          isPropertyAnnotated = owner.getIdentifierProperty().getPropertyAccessorName().equals( "property" );
        }
        else if ( owner.getIdentifierMapper() != null && owner.getIdentifierMapper().getPropertySpan() > 0 ) {
          Property prop = (Property) owner.getIdentifierMapper().getPropertyIterator().next();
          isPropertyAnnotated = prop.getPropertyAccessorName().equals( "property" );
        }
        else {
          throw new AssertionFailure( "Unable to guess collection property accessor name" );
        }

        PropertyData inferredData;
        if ( isMap() ) {
          //"value" is the JPA 2 prefix for map values (used to be "element")
          if ( isHibernateExtensionMapping() ) {
            inferredData = new PropertyPreloadedData( AccessType.PROPERTY, "element", elementClass );
          }
View Full Code Here

      if ( !BinderHelper.isDefault( fkName ) ) element.setForeignKeyName( fkName );
    }
    else if ( anyAnn != null ) {
      //@ManyToAny
      //Make sure that collTyp is never used during the @ManyToAny branch: it will be set to void.class
      PropertyData inferredData = new PropertyInferredData( property, "unsupported", mappings.getReflectionManager() );
      //override the table
      for (Ejb3Column column : inverseJoinColumns) {
        column.setTable( collValue.getCollectionTable() );
      }
      Any any = BinderHelper.buildAnyValue( anyAnn.metaDef(), inverseJoinColumns, anyAnn.metaColumn(),
          inferredData, cascadeDeleteEnabled, Nullability.NO_CONSTRAINT,
          propertyHolder, new EntityBinder(), true, mappings );
      collValue.setElement( any );
    }
    else {
      XClass elementClass;
      AnnotatedClassType classType;
//      Map<String, javax.persistence.Column[]> columnOverrides = PropertyHolderBuilder.buildColumnOverride(
//          property, StringHelper.qualify( collValue.getRole(), "element" )
//      );
      //FIXME the "element" is lost
      PropertyHolder holder = null;
      if ( BinderHelper.PRIMITIVE_NAMES.contains( collType.getName() ) ) {
        classType = AnnotatedClassType.NONE;
        elementClass = null;
      }
      else {
        elementClass = collType;
        classType = mappings.getClassType( elementClass );

        holder = PropertyHolderBuilder.buildPropertyHolder(
            collValue,
            collValue.getRole(), // + ".element",
            elementClass,
            property, parentPropertyHolder, mappings
        );
        //force in case of attribute override
        boolean attributeOverride = property.isAnnotationPresent( AttributeOverride.class )
            || property.isAnnotationPresent( AttributeOverrides.class );
        if ( isEmbedded || attributeOverride ) {
          classType = AnnotatedClassType.EMBEDDABLE;
        }
      }

      if ( AnnotatedClassType.EMBEDDABLE.equals( classType ) ) {
        EntityBinder entityBinder = new EntityBinder();
        PersistentClass owner = collValue.getOwner();
        boolean isPropertyAnnotated;
        //FIXME support @Access for collection of elements
        //String accessType = access != null ? access.value() : null;
        if ( owner.getIdentifierProperty() != null ) {
          isPropertyAnnotated = owner.getIdentifierProperty().getPropertyAccessorName().equals( "property" );
        }
        else if ( owner.getIdentifierMapper() != null && owner.getIdentifierMapper().getPropertySpan() > 0 ) {
          Property prop = (Property) owner.getIdentifierMapper().getPropertyIterator().next();
          isPropertyAnnotated = prop.getPropertyAccessorName().equals( "property" );
        }
        else {
          throw new AssertionFailure( "Unable to guess collection property accessor name" );
        }

        //boolean propertyAccess = embeddable == null || AccessType.PROPERTY.equals( embeddable.access() );
        PropertyData inferredData = new PropertyPreloadedData( "property", "element", elementClass );
        //TODO be smart with isNullable
        Component component = AnnotationBinder.fillComponent(
            holder, inferredData, isPropertyAnnotated, isPropertyAnnotated ? "property" : "field", true,
            entityBinder, false, false,
            true, mappings
View Full Code Here

      if ( !BinderHelper.isEmptyAnnotationValue( fkName ) ) element.setForeignKeyName( fkName );
    }
    else if ( anyAnn != null ) {
      //@ManyToAny
      //Make sure that collTyp is never used during the @ManyToAny branch: it will be set to void.class
      PropertyData inferredData = new PropertyInferredData(null, property, "unsupported", mappings.getReflectionManager() );
      //override the table
      for (Ejb3Column column : inverseJoinColumns) {
        column.setTable( collValue.getCollectionTable() );
      }
      Any any = BinderHelper.buildAnyValue( anyAnn.metaDef(), inverseJoinColumns, anyAnn.metaColumn(),
          inferredData, cascadeDeleteEnabled, Nullability.NO_CONSTRAINT,
          propertyHolder, new EntityBinder(), true, mappings );
      collValue.setElement( any );
    }
    else {
      XClass elementClass;
      AnnotatedClassType classType;

      PropertyHolder holder = null;
      if ( BinderHelper.PRIMITIVE_NAMES.contains( collType.getName() ) ) {
        classType = AnnotatedClassType.NONE;
        elementClass = null;
      }
      else {
        elementClass = collType;
        classType = mappings.getClassType( elementClass );

        holder = PropertyHolderBuilder.buildPropertyHolder(
            collValue,
            collValue.getRole(),
            elementClass,
            property, parentPropertyHolder, mappings
        );
        //force in case of attribute override
        boolean attributeOverride = property.isAnnotationPresent( AttributeOverride.class )
            || property.isAnnotationPresent( AttributeOverrides.class );
        if ( isEmbedded || attributeOverride ) {
          classType = AnnotatedClassType.EMBEDDABLE;
        }
      }

      if ( AnnotatedClassType.EMBEDDABLE.equals( classType ) ) {
        EntityBinder entityBinder = new EntityBinder();
        PersistentClass owner = collValue.getOwner();
        boolean isPropertyAnnotated;
        //FIXME support @Access for collection of elements
        //String accessType = access != null ? access.value() : null;
        if ( owner.getIdentifierProperty() != null ) {
          isPropertyAnnotated = owner.getIdentifierProperty().getPropertyAccessorName().equals( "property" );
        }
        else if ( owner.getIdentifierMapper() != null && owner.getIdentifierMapper().getPropertySpan() > 0 ) {
          Property prop = (Property) owner.getIdentifierMapper().getPropertyIterator().next();
          isPropertyAnnotated = prop.getPropertyAccessorName().equals( "property" );
        }
        else {
          throw new AssertionFailure( "Unable to guess collection property accessor name" );
        }

        PropertyData inferredData;
        if ( isMap() ) {
          //"value" is the JPA 2 prefix for map values (used to be "element")
          if ( isHibernateExtensionMapping() ) {
            inferredData = new PropertyPreloadedData( AccessType.PROPERTY, "element", elementClass );
          }
View Full Code Here

      }
    }
    else if ( anyAnn != null ) {
      //@ManyToAny
      //Make sure that collTyp is never used during the @ManyToAny branch: it will be set to void.class
      PropertyData inferredData = new PropertyInferredData(null, property, "unsupported", mappings.getReflectionManager() );
      //override the table
      for (Ejb3Column column : inverseJoinColumns) {
        column.setTable( collValue.getCollectionTable() );
      }
      Any any = BinderHelper.buildAnyValue( anyAnn.metaDef(), inverseJoinColumns, anyAnn.metaColumn(),
          inferredData, cascadeDeleteEnabled, Nullability.NO_CONSTRAINT,
          propertyHolder, new EntityBinder(), true, mappings );
      collValue.setElement( any );
    }
    else {
      XClass elementClass;
      AnnotatedClassType classType;

      PropertyHolder holder = null;
      if ( BinderHelper.PRIMITIVE_NAMES.contains( collType.getName() ) ) {
        classType = AnnotatedClassType.NONE;
        elementClass = null;
      }
      else {
        elementClass = collType;
        classType = mappings.getClassType( elementClass );

        holder = PropertyHolderBuilder.buildPropertyHolder(
            collValue,
            collValue.getRole(),
            elementClass,
            property, parentPropertyHolder, mappings
        );
        //force in case of attribute override
        boolean attributeOverride = property.isAnnotationPresent( AttributeOverride.class )
            || property.isAnnotationPresent( AttributeOverrides.class );
        if ( isEmbedded || attributeOverride ) {
          classType = AnnotatedClassType.EMBEDDABLE;
        }
      }

      if ( AnnotatedClassType.EMBEDDABLE.equals( classType ) ) {
        EntityBinder entityBinder = new EntityBinder();
        PersistentClass owner = collValue.getOwner();
        boolean isPropertyAnnotated;
        //FIXME support @Access for collection of elements
        //String accessType = access != null ? access.value() : null;
        if ( owner.getIdentifierProperty() != null ) {
          isPropertyAnnotated = owner.getIdentifierProperty().getPropertyAccessorName().equals( "property" );
        }
        else if ( owner.getIdentifierMapper() != null && owner.getIdentifierMapper().getPropertySpan() > 0 ) {
          Property prop = (Property) owner.getIdentifierMapper().getPropertyIterator().next();
          isPropertyAnnotated = prop.getPropertyAccessorName().equals( "property" );
        }
        else {
          throw new AssertionFailure( "Unable to guess collection property accessor name" );
        }

        PropertyData inferredData;
        if ( isMap() ) {
          //"value" is the JPA 2 prefix for map values (used to be "element")
          if ( isHibernateExtensionMapping() ) {
            inferredData = new PropertyPreloadedData( AccessType.PROPERTY, "element", elementClass );
          }
View Full Code Here

        }

        if ( AnnotatedClassType.EMBEDDABLE.equals( classType ) ) {
          EntityBinder entityBinder = new EntityBinder();

          PropertyData inferredData;
          if ( isHibernateExtensionMapping() ) {
            inferredData = new PropertyPreloadedData( AccessType.PROPERTY, "index", elementClass );
          }
          else {
            //"key" is the JPA 2 prefix for map keys
View Full Code Here

          else {
            throw new AssertionFailure( "Unable to guess collection property accessor name" );
          }


          PropertyData inferredData;
          if ( isHibernateExtensionMapping() ) {
            inferredData = new PropertyPreloadedData( AccessType.PROPERTY, "index", elementClass );
          }
          else {
            //"key" is the JPA 2 prefix for map keys
View Full Code Here

        }

        if ( AnnotatedClassType.EMBEDDABLE.equals( classType ) ) {
          EntityBinder entityBinder = new EntityBinder();

          PropertyData inferredData;
          if ( isHibernateExtensionMapping() ) {
            inferredData = new PropertyPreloadedData( AccessType.PROPERTY, "index", elementClass );
          }
          else {
            //"key" is the JPA 2 prefix for map keys
View Full Code Here

TOP

Related Classes of org.hibernate.cfg.PropertyData

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.