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


          return getJavaTypeName(a.getElement(), preferRawTypeNames) + "[]";
        }
      }

      if ( value instanceof Component ) { // same for component.       
        Component component = ( (Component) value );
        if(component.isDynamic()) return "java.util.Map";
        return component.getComponentClassName();
      }
     
      if ( useGenerics ) {
        if ( value instanceof Collection ) {
          String decl = getGenericCollectionDeclaration( (Collection) value, preferRawTypeNames, importContext );
View Full Code Here

   * @param compositeKeyColumns
   * @param processed
   * @return
   */
  private SimpleValue handleCompositeKey(RootClass rc, Set processedColumns, List keyColumns, Mapping mapping) {
    Component pkc = new Component(rc);
        pkc.setMetaAttributes(Collections.EMPTY_MAP);
        pkc.setEmbedded(false);

        String compositeIdName = revengStrategy.tableToCompositeIdName(TableIdentifier.create(rc.getTable()));
        if(compositeIdName==null) {
          compositeIdName = revengStrategy.classNameToCompositeIdName(rc.getClassName());
        }
        pkc.setComponentClassName(compositeIdName);
    Table table = rc.getTable();
        List list = null;
    if (cfg.preferBasicCompositeIds() ) {
            list = new ArrayList(keyColumns);
        }
    else {
            list = findForeignKeys(table.getForeignKeyIterator(), keyColumns);
        }
        for (Iterator iter = list.iterator(); iter.hasNext();) {
            Object element = iter.next();
      Property property;
            if (element instanceof Column) {
                Column column = (Column) element;
                if ( processedColumns.contains(column) ) {
                    throw new JDBCBinderException("Binding column twice for primary key should not happen: " + column);
                }
        else {
                    checkColumn(column);

                    String propertyName = revengStrategy.columnToPropertyName( TableIdentifier.create(table), column.getName() );
          property = bindBasicProperty( makeUnique(pkc, propertyName), table, column, processedColumns, mapping);

                    processedColumns.add(column);
                }
            }
      else if (element instanceof ForeignKeyForColumns) {
                ForeignKeyForColumns fkfc = (ForeignKeyForColumns) element;
                ForeignKey foreignKey = fkfc.key;
                String propertyName = revengStrategy.foreignKeyToEntityName(
            foreignKey.getName(),
            TableIdentifier.create(foreignKey.getTable() ),
            foreignKey.getColumns(), TableIdentifier.create(foreignKey.getReferencedTable() ), foreignKey.getReferencedColumns(), true
          );
                property = bindManyToOne( makeUnique(pkc, propertyName), true, table, foreignKey, processedColumns);
                processedColumns.addAll(fkfc.columns);
            }
      else {
        throw new JDBCBinderException("unknown thing");
      }

            markAsUseInEquals(property);
            pkc.addProperty(property);

    }

    return pkc;
  }
View Full Code Here

  }

  private static void bindCompositeId(Element idNode, RootClass entity, Mappings mappings,
      java.util.Map inheritedMetas) throws MappingException {
    String propertyName = idNode.attributeValue( "name" );
    Component id = new Component( entity );
    entity.setIdentifier( id );
    bindCompositeId( idNode, id, entity, propertyName, mappings, inheritedMetas );
    if ( propertyName == null ) {
      entity.setEmbeddedIdentifier( id.isEmbedded() );
      if ( id.isEmbedded() ) {
        // todo : what is the implication of this?
        id.setDynamic( !entity.hasPojoRepresentation() );
        /*
         * Property prop = new Property(); prop.setName("id");
         * prop.setPropertyAccessorName("embedded"); prop.setValue(id);
         * entity.setIdentifierProperty(prop);
         */
 
View Full Code Here

        value = new SimpleValue( table );
        bindSimpleValue( subnode, (SimpleValue) value, true, propertyName, mappings );
      }
      else if ( "component".equals( name ) || "dynamic-component".equals( name ) ) {
        String subpath = StringHelper.qualify( path, propertyName );
        value = new Component( join );
        bindComponent(
            subnode,
            (Component) value,
            join.getPersistentClass().getClassName(),
            propertyName,
View Full Code Here

    if ( "true".equals( node.attributeValue("mapped") ) ) {
      if ( propertyName!=null ) {
        throw new MappingException("cannot combine mapped=\"true\" with specified name");
      }
      Component mapper = new Component(persistentClass);
      bindComponent(
          node,
          mapper,
          persistentClass.getClassName(),
          null,
View Full Code Here

        bindSimpleValue( subnode, (SimpleValue) value, isNullable, relativePath, mappings );
      }
      else if ( "component".equals( name )
        || "dynamic-component".equals( name )
        || "nested-composite-element".equals( name ) ) {
        value = new Component( component ); // a nested composite element
        bindComponent(
            subnode,
            (Component) value,
            component.getComponentClassName(),
            propertyName,
View Full Code Here

      }
      else if ( "component".equals( name )
        || "dynamic-component".equals( name )
        || "properties".equals( name ) ) {
        String subpath = StringHelper.qualify( entityName, propertyName );
        value = new Component( persistentClass );

        bindComponent(
            subnode,
            (Component) value,
            persistentClass.getClassName(),
View Full Code Here

          );
        map.setIndex( mto );

      }
      else if ( "composite-index".equals( name ) || "composite-map-key".equals( name ) ) {
        Component component = new Component( map );
        bindComposite(
            subnode,
            component,
            map.getRole() + ".index",
            map.isOneToMany(),
View Full Code Here

            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

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.