Package org.hibernate.mapping

Examples of org.hibernate.mapping.Column


      }
      else {
        mappedByColumns = property.getValue().getColumnIterator();
      }
      while ( mappedByColumns.hasNext() ) {
        Column column = (Column) mappedByColumns.next();
        columns[0].overrideFromReferencedColumnIfNecessary( column );
        columns[0].linkValueUsingAColumnCopy( column, value );
      }
    }
    else if ( columns[0].isImplicit() ) {
      /**
       * if columns are implicit, then create the columns based on the
       * referenced entity id columns
       */
      Iterator idColumns;
      if ( referencedEntity instanceof JoinedSubclass ) {
        idColumns = ( (JoinedSubclass) referencedEntity ).getKey().getColumnIterator();
      }
      else {
        idColumns = referencedEntity.getIdentifier().getColumnIterator();
      }
      while ( idColumns.hasNext() ) {
        Column column = (Column) idColumns.next();
        columns[0].overrideFromReferencedColumnIfNecessary( column );
        columns[0].linkValueUsingDefaultColumnNaming( column, referencedEntity, value );
      }
    }
    else {
View Full Code Here


  private static void linkJoinColumnWithValueOverridingNameIfImplicit(
      PersistentClass referencedEntity, Iterator columnIterator, Ejb3JoinColumn[] columns, SimpleValue value
  ) { 
    for (Ejb3JoinColumn joinCol : columns) {
      Column synthCol = (Column) columnIterator.next();         
      if ( joinCol.isNameDeferred() ) {
        //this has to be the default value
        joinCol.linkValueUsingDefaultColumnNaming( synthCol, referencedEntity, value );
      }
      else {
View Full Code Here

    loaderName = persistentClass.getLoaderName();

    Iterator iter = persistentClass.getIdentifier().getColumnIterator();
    int i = 0;
    while ( iter.hasNext() ) {
      Column col = ( Column ) iter.next();
      rootTableKeyColumnNames[i] = col.getQuotedName( factory.getDialect() );
      identifierAliases[i] = col.getAlias( factory.getDialect(), persistentClass.getRootTable() );
      i++;
    }

    // VERSION
View Full Code Here

              //.append(" as ") //Oracle doesn't support it in subqueries
          .append( " " )
          .append( alias ).append( " where " );
      Iterator collectionTableColumns = element.getColumnIterator();
      while ( collectionTableColumns.hasNext() ) {
        Column colColumn = (Column) collectionTableColumns.next();
        Column refColumn = (Column) referencedEntityColumns.next();
        fromAndWhereSb.append( alias ).append( '.' ).append( refColumn.getQuotedName() )
            .append( '=' ).append( colColumn.getQuotedName() ).append( " and " );
      }
      fromAndWhere = fromAndWhereSb.substring( 0, fromAndWhereSb.length() - 5 );
    }
View Full Code Here

              "columnOwner neither PersistentClass nor Join: " + columnOwner.getClass()
      );
    }
    //build the list of column names
    for (Ejb3JoinColumn column1 : columns) {
      Column column = new Column(
          mappings.getPhysicalColumnName( column1.getReferencedColumn(), referencedTable )
      );
      orderedColumns.add( column );
      columnsToProperty.put( column, new HashSet<Property>() );
    }
View Full Code Here

      return false;
    }
  }

  public void apply(Property property) {
    Column col = (Column) property.getColumnIterator().next();
    String check = "";
    if ( min != Long.MIN_VALUE ) check += col.getName() + ">=" + min;
    if ( max != Long.MAX_VALUE && min != Long.MIN_VALUE ) check += " and ";
    if ( max != Long.MAX_VALUE ) check += col.getName() + "<=" + max;
    col.setCheckConstraint( check );
  }
View Full Code Here

        }
        if ( key == null ) key = property.getPersistentClass().getIdentifier();
        mappedByColumns = key.getColumnIterator();
      }
      while ( mappedByColumns.hasNext() ) {
        Column column = (Column) mappedByColumns.next();
        columns[0].linkValueUsingAColumnCopy( column, value );
      }
      String referencedPropertyName =
          mappings.getPropertyReferencedAssociation(
              "inverse__" + referencedEntity.getEntityName(), mappedBy
View Full Code Here

      Value identifier,
      Map<String, Join> joins,
      PropertyHolder propertyHolder, ExtendedMappings mappings
  ) {

    Column col = (Column) identifier.getColumnIterator().next();
    String defaultName = mappings.getLogicalColumnName( col.getQuotedName(), identifier.getTable() );
    if ( pkJoinAnn != null || joinAnn != null ) {
      String colName;
      String columnDefinition;
      String referencedColumnName;
      if ( pkJoinAnn != null ) {
View Full Code Here

              "Unable to find column with logical name: "
                  + logicalReferencedColumnName + " in " + matchingTable.getName()
          );
        }
        noReferencedColumn = false;
        Column refCol = new Column( referencedColumnName );
        boolean contains = idColumns.contains( refCol );
        if ( !contains ) {
          isFkReferencedColumnName = true;
          break; //we know the state
        }
View Full Code Here

      addConstraintToColumn( mappings.getLogicalColumnName( column.getMappingColumn().getQuotedName(), table ) );
    }
  }

  private void addConstraintToColumn(String columnName) {
    Column column = table.getColumn(
        new Column(
            mappings.getPhysicalColumnName( columnName, table )
        )
    );
    if ( column == null ) {
      throw new AnnotationException(
View Full Code Here

TOP

Related Classes of org.hibernate.mapping.Column

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.