Package org.hibernate.mapping

Examples of org.hibernate.mapping.Component


            mappings
          );
        bindManyToManySubelements( collection, subnode, mappings );
      }
      else if ( "composite-element".equals( name ) ) {
        Component element = new Component( collection );
        collection.setElement( element );
        bindComposite(
            subnode,
            element,
            collection.getRole() + ".element",
View Full Code Here


    while ( propertyIterator.hasNext() ) {

      Property prop = ( Property ) propertyIterator.next();
      String propname = path == null ? prop.getName() : path + "." + prop.getName();
      if ( prop.isComposite() ) {
        Component component = ( Component ) prop.getValue();
        Iterator compProps = component.getPropertyIterator();
        internalInitSubclassPropertyAliasesMap( propname, compProps );
      }
      else {
        String[] aliases = new String[prop.getColumnSpan()];
        String[] cols = new String[prop.getColumnSpan()];
View Full Code Here

            propertyAccessedPersistentProperties.add(property.getName());
        }
    }

    private void createPropertiesGroupMapping(Property property) {
        Component component = (Component) property.getValue();
        Iterator<Property> componentProperties = component.getPropertyIterator();
        while (componentProperties.hasNext()) {
            Property componentProperty = componentProperties.next();
            propertiesGroupMapping.put(componentProperty.getName(), component.getNodeName());
        }
    }
View Full Code Here

      case ENTITY: {
        final org.hibernate.type.EntityType type = (EntityType) typeContext.getValue().getType();
        return (Type<Y>) context.locateEntityType( type.getAssociatedEntityName() );
      }
      case EMBEDDABLE: {
        final Component component = (Component) typeContext.getValue();
        final EmbeddableTypeImpl<Y> embeddableType = new EmbeddableTypeImpl<Y>(
            typeContext.getBindableType(),
            typeContext.getAttributeMetadata().getOwnerType(),
            (ComponentType) typeContext.getValue().getType()
        );
        context.registerEmbeddedableType( embeddableType );
        final Iterator<Property> subProperties = component.getPropertyIterator();
        while ( subProperties.hasNext() ) {
          final Property property = subProperties.next();
          embeddableType.getBuilder().addAttribute( buildAttribute( embeddableType, property) );
        }
        embeddableType.lock();
View Full Code Here

        Element rel_id_mapping = new DefaultElement("properties");
        // Xml mapping which will be used for the primary key of the versions table
        Element orig_id_mapping = new DefaultElement("composite-id");

        Property id_prop = pc.getIdentifierProperty();
        Component id_mapper = pc.getIdentifierMapper();

        // Checking if the id mapping is supported
        if (id_mapper == null && id_prop == null) {
            return null;
        }

        SimpleIdMapperBuilder mapper;
        if (id_mapper != null) {
            // Multiple id

            mapper = new MultipleIdMapper(((Component) pc.getIdentifier()).getComponentClassName());
            if (!addIdProperties(rel_id_mapping, (Iterator<Property>) id_mapper.getPropertyIterator(), mapper, false, audited)) {
                return null;
            }

            // null mapper - the mapping where already added the first time, now we only want to generate the xml
            if (!addIdProperties(orig_id_mapping, (Iterator<Property>) id_mapper.getPropertyIterator(), null, true, audited)) {
                return null;
            }
        } else if (id_prop.isComposite()) {
            // Embedded id

            Component id_component = (Component) id_prop.getValue();

            mapper = new EmbeddedIdMapper(getIdPropertyData(id_prop), id_component.getComponentClassName());
            if (!addIdProperties(rel_id_mapping, (Iterator<Property>) id_component.getPropertyIterator(), mapper, false, audited)) {
                return null;
            }

            // null mapper - the mapping where already added the first time, now we only want to generate the xml
            if (!addIdProperties(orig_id_mapping, (Iterator<Property>) id_component.getPropertyIterator(), null, true, audited)) {
                return null;
            }
        } else {
            // Single id
           
View Full Code Here

      jpaEntityType.getBuilder().applyIdClassAttributes( attributes );
    }
    else {
      final KeyValue value = persistentClass.getIdentifier();
      if (value instanceof Component ) {
        final Component component = ( Component ) value;
        if ( component.getPropertySpan() > 1 ) {
          //FIXME we are an Hibernate embedded id (ie not type)
        }
        else {
          //FIXME take care of declared vs non declared property
          jpaEntityType.getBuilder().applyIdAttribute(
            attributeFactory.buildIdAttribute(
                jpaEntityType,
                (Property) component.getPropertyIterator().next() )
          );
        }
      }
    }
  }
View Full Code Here

            inferredData = new PropertyPreloadedData( AccessType.PROPERTY, "collection&&element", elementClass );
          }
        }
        //TODO be smart with isNullable
        boolean isNullable = true;
        Component component = AnnotationBinder.fillComponent(
            holder,
            inferredData,
            isPropertyAnnotated ? AccessType.PROPERTY : AccessType.FIELD,
            isNullable,
            entityBinder,
View Full Code Here

            //"key" is the JPA 2 prefix for map keys
            inferredData = new PropertyPreloadedData( AccessType.PROPERTY, "key", keyXClass );
          }

          //TODO be smart with isNullable
          Component component = AnnotationBinder.fillComponent(
              holder,
              inferredData,
              accessType,
              true,
              entityBinder,
View Full Code Here

      }
      fromAndWhere = fromAndWhereSb.substring( 0, fromAndWhereSb.length() - 5 );
    }

    if ( value instanceof Component ) {
      Component component = (Component) value;
      Iterator properties = component.getPropertyIterator();
      Component indexComponent = new Component( mappings, collection );
      indexComponent.setComponentClassName( component.getComponentClassName() );
      //TODO I don't know if this is appropriate
      indexComponent.setNodeName( "index" );
      while ( properties.hasNext() ) {
        Property current = (Property) properties.next();
        Property newProperty = new Property();
        newProperty.setCascade( current.getCascade() );
        newProperty.setValueGenerationStrategy( current.getValueGenerationStrategy() );
        newProperty.setInsertable( false );
        newProperty.setUpdateable( false );
        newProperty.setMetaAttributes( current.getMetaAttributes() );
        newProperty.setName( current.getName() );
        newProperty.setNodeName( current.getNodeName() );
        newProperty.setNaturalIdentifier( false );
        //newProperty.setOptimisticLocked( false );
        newProperty.setOptional( false );
        newProperty.setPersistentClass( current.getPersistentClass() );
        newProperty.setPropertyAccessorName( current.getPropertyAccessorName() );
        newProperty.setSelectable( current.isSelectable() );
        newProperty.setValue(
            createFormulatedValue(
                current.getValue(), collection, targetPropertyName, associatedClass, mappings
            )
        );
        indexComponent.addProperty( newProperty );
      }
      return indexComponent;
    }
    else if ( value instanceof SimpleValue ) {
      SimpleValue sourceValue = (SimpleValue) value;
View Full Code Here

      case ENTITY: {
        final org.hibernate.type.EntityType type = (EntityType) typeContext.getValue().getType();
        return (Type<Y>) context.locateEntityType( type.getAssociatedEntityName() );
      }
      case EMBEDDABLE: {
        final Component component = (Component) typeContext.getValue();
        final EmbeddableTypeImpl<Y> embeddableType = new EmbeddableTypeImpl<Y>(
            typeContext.getBindableType(),
            typeContext.getAttributeMetadata().getOwnerType(),
            (ComponentType) typeContext.getValue().getType()
        );
        context.registerEmbeddedableType( embeddableType );
        final Iterator<Property> subProperties = component.getPropertyIterator();
        while ( subProperties.hasNext() ) {
          final Property property = subProperties.next();
          final AttributeImplementor<Y, Object> attribute = buildAttribute( embeddableType, property );
          if ( attribute != null ) {
            embeddableType.getBuilder().addAttribute( attribute );
View Full Code Here

TOP

Related Classes of org.hibernate.mapping.Component

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.