Package org.hibernate.mapping

Examples of org.hibernate.mapping.Component$ValueGenerationPlan


        int dotIndex = name.lastIndexOf( '.' );
        String reducedName = name.substring( 0, dotIndex );
        Value value = pc.getRecursiveProperty( reducedName ).getValue();
        Iterator parentPropIter;
        if ( value instanceof Component ) {
          Component comp = (Component) value;
          parentPropIter = comp.getPropertyIterator();
        }
        else if ( value instanceof ToOne ) {
          ToOne toOne = (ToOne) value;
          PersistentClass referencedPc = mappings.getClass( toOne.getReferencedEntityName() );
          if ( toOne.getReferencedPropertyName() != null ) {
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

    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

            exporter.endMapping(cfg);
        }
    }
   
    for(Iterator comps = components.values().iterator(); comps.hasNext(); ) {
      Component component = (Component)comps.next();
      exporter.startComponent(component);
    }
   
    if (exporter.startGeneralConfiguration(cfg) )
      exporter.endGeneralConfiguration(cfg);
View Full Code Here

  private static void collectComponents(Map components, Iterator iter) {
    while(iter.hasNext()) {
      Property property = (Property) iter.next();
      if (!"embedded".equals(property.getPropertyAccessorName()) && // HBX-267, embedded property for <properties> should not be generated as component.
        property.getValue() instanceof Component) {
        Component comp = (Component) property.getValue();
        addComponent( components, comp );     
      }
      else if (property.getValue() instanceof Collection) {
        // compisite-element in collection
        Collection collection = (Collection) property.getValue();       
        if ( collection.getElement() instanceof Component) {
          Component comp = (Component) collection.getElement();       
          addComponent(components, comp);       
        }
      }
    }
  }
View Full Code Here

    }
  }

  private static void addComponent(Map components, Component comp) {
    if(!comp.isDynamic()) {
      Component existing = (Component) components.put(comp.getComponentClassName(), comp);
     
      if(existing!=null) {
        log.warn("Component " + existing.getComponentClassName() + " found more than once! Will only generate the last found.");
      }
    } else {
      log.debug("dynamic-component found. Ignoring it as a component, but will collect any embedded components.");
   
    collectComponents( components, new ComponentPOJOClass(comp, new Cfg2JavaTool()).getAllPropertiesIterator());   
View Full Code Here

      // only include identifier for the root class.
      if ( pc.hasIdentifierProperty() ) {
        properties.add( pc.getIdentifierProperty() );
      }
      else if ( pc.hasEmbeddedIdentifier() ) {
        Component embeddedComponent = (Component) pc.getIdentifier();
        iterators.add( embeddedComponent.getPropertyIterator() );
      }
      /*if(clazz.isVersioned() ) { // version is already in property set
        properties.add(clazz.getVersion() );
      }*/
    }


    //    iterators.add( pc.getPropertyIterator() );
    // Need to skip <properties> element which are defined via "embedded" components
    // Best if we could return an intelligent iterator, but for now we just iterate explicitly.
    Iterator pit = pc.getPropertyIterator();
    while(pit.hasNext())
    {
      Property element = (Property) pit.next();
      if ( element.getValue() instanceof Component
          && element.getPropertyAccessorName().equals( "embedded" )) {
        Component component = (Component) element.getValue();
        // need to "explode" property to get proper sequence in java code.
        Iterator embeddedProperty = component.getPropertyIterator();
        while(embeddedProperty.hasNext()) {
          properties.add(embeddedProperty.next());
        }
      } else {
        properties.add(element);
View Full Code Here

            }
        }
       
        Iterator iterator = components.values().iterator();
    while ( iterator.hasNext() ) {         
      Component component = (Component) iterator.next();
      ComponentPOJOClass element = new ComponentPOJOClass(component,cfg2JavaTool);
      this.processClass(element);
    }
    }
View Full Code Here

     * @return POJOClass for Property
     */
    //TODO We haven't taken into account Array?
    public POJOClass getComponentPOJO(Property property){
      if (property.getValue() instanceof Component) {
        Component comp = (Component) property.getValue();
        ComponentPOJOClass componentPOJOClass = new ComponentPOJOClass(comp, new Cfg2JavaTool());       
        return componentPOJOClass;
      }
        else{
        return null;
View Full Code Here

        int dotIndex = name.lastIndexOf( '.' );
        String reducedName = name.substring( 0, dotIndex );
        Value value = pc.getRecursiveProperty( reducedName ).getValue();
        Iterator parentPropIter;
        if ( value instanceof Component ) {
          Component comp = (Component) value;
          parentPropIter = comp.getPropertyIterator();
        }
        else if ( value instanceof ToOne ) {
          ToOne toOne = (ToOne) value;
          PersistentClass referencedPc = mappings.getClass( toOne.getReferencedEntityName() );
          if ( toOne.getReferencedPropertyName() != null ) {
View Full Code Here

TOP

Related Classes of org.hibernate.mapping.Component$ValueGenerationPlan

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.