Package org.hibernate.mapping

Examples of org.hibernate.mapping.Property


           
            this.processClass(pojoClazz);
           
            Iterator properties = clazz.getPropertyIterator();
            while (properties.hasNext() ) {
                Property property = (Property) properties.next();
                Value value = property.getValue();               
                List props = (List) propsByValue.get(value);
                if (props == null) {
                    props = new ArrayList();
                    propsByValue.put(value, props);
                }
View Full Code Here


    if(clazz.hasIdentifierProperty()) {
      this.visitProperty(getConfiguration(), clazz, clazz.getIdentifierProperty(), collector);               
    }
    Iterator propertyIterator = clazz.getPropertyIterator();
    while ( propertyIterator.hasNext() ) {
      Property property = (Property) propertyIterator.next();
      this.visitProperty(getConfiguration(), clazz, property, collector);         
     
    }
  }
View Full Code Here

 
  public List getPropertiesForMinimalConstructor() {
    List res = new ArrayList();
    Iterator iter = getAllPropertiesIterator();
    while(iter.hasNext()) {
      Property prop = (Property)iter.next();
      if(isRequiredInConstructor(prop)) {
        res.add(prop);
      }     
    }
    return res;
View Full Code Here

  public abstract Iterator getAllPropertiesIterator();

  protected String generateEquals(String thisName, String otherName, Iterator allPropertiesIterator, boolean useGenerics) {
    StringBuffer buf = new StringBuffer();
    while ( allPropertiesIterator.hasNext() ) {
      Property property = (Property) allPropertiesIterator.next();
        if ( buf.length() > 0 ) buf.append( "\n && " );
        String javaTypeName = c2j.getJavaTypeName( property, useGenerics, this );
        buf.append(
            internalgenerateEquals(
                javaTypeName, thisName + "." + getGetterSignature( property ) + "()",
View Full Code Here

    return getMetaAsString( "class-code", "\n" );
  }
 
  private boolean needsEqualsHashCode(Iterator iter) {
    while ( iter.hasNext() ) {
      Property element = (Property) iter.next();
      if ( usePropertyInEquals( element ) ) {
        return true;
      }
    }
    return false;
View Full Code Here

    return annotations.toString();
  }

  private void buildRecursiveAttributeOverride(Iterator subElements, String path, Property property, StringBuffer annotations) {
    while ( subElements.hasNext() ) {
      Property subProperty = (Property) subElements.next();
      if ( subProperty.isComposite() ) {
        if ( path != null ) {
          path = path + ".";
        }
        else {
          path = "";
        }
        path = path + subProperty.getName();
        Component component = (Component) subProperty.getValue();
        buildRecursiveAttributeOverride( component.getPropertyIterator(), path, subProperty, annotations );
      }
      else {
        Iterator columns = subProperty.getColumnIterator();
        Selectable selectable = (Selectable) columns.next();
        if ( selectable.isFormula() ) {
          //TODO formula in multicolumns not supported by annotations
        }
        else {
          annotations.append( "\n        " ).append("@")
              .append( importType("javax.persistence.AttributeOverride") ).append("(name=\"" );
          if ( path != null ) {
            annotations.append( path ).append( "." );
          }
          annotations.append( subProperty.getName() ).append( "\"" )
              .append( ", column=" );
          buildColumnAnnotation(
              selectable, annotations, subProperty.isInsertable(), subProperty.isUpdateable()
          );
          annotations.append( " ), " );
        }
      }
    }
View Full Code Here

    naturalOrderPropertyTableNumbers = new int[hydrateSpan];
    propertyTableNumbers = new int[hydrateSpan];
    Iterator iter = persistentClass.getPropertyClosureIterator();
    int i=0;
    while( iter.hasNext() ) {
      Property prop = (Property) iter.next();
      String tabname = prop.getValue().getTable().getQualifiedName(
        factory.getDialect(),
        factory.getSettings().getDefaultCatalogName(),
        factory.getSettings().getDefaultSchemaName()
      );
      propertyTableNumbers[i] = getTableId(tabname, tableNames);
      naturalOrderPropertyTableNumbers[i] = getTableId(tabname, naturalOrderTableNames);
      i++;
    }

    // subclass closure properties

    //TODO: code duplication with SingleTableEntityPersister

    ArrayList columnTableNumbers = new ArrayList();
    ArrayList formulaTableNumbers = new ArrayList();
    ArrayList propTableNumbers = new ArrayList();

    iter = persistentClass.getSubclassPropertyClosureIterator();
    while ( iter.hasNext() ) {
      Property prop = (Property) iter.next();
      Table tab = prop.getValue().getTable();
      String tabname = tab.getQualifiedName(
          factory.getDialect(),
          factory.getSettings().getDefaultCatalogName(),
          factory.getSettings().getDefaultSchemaName()
      );
      Integer tabnum = new Integer( getTableId(tabname, subclassTableNameClosure) );
      propTableNumbers.add(tabnum);

      Iterator citer = prop.getColumnIterator();
      while ( citer.hasNext() ) {
        Selectable thing = (Selectable) citer.next();
        if ( thing.isFormula() ) {
          formulaTableNumbers.add(tabnum);
        }
View Full Code Here

            "property-ref to unmapped class: " +
            upr.referencedClass
          );
      }

      Property prop = clazz.getReferencedProperty( upr.propertyName );
      if ( upr.unique ) {
        ( (SimpleValue) prop.getValue() ).setAlternateUniqueKey( true );
      }
    }

    //TODO: Somehow add the newly created foreign keys to the internal collection
View Full Code Here

      public Type getReferencedPropertyType(String persistentClass, String propertyName) throws MappingException {
        final PersistentClass pc = (PersistentClass) classes.get( persistentClass );
        if ( pc == null ) {
          throw new MappingException( "persistent class not known: " + persistentClass );
        }
        Property prop = pc.getReferencedProperty( propertyName );
        if ( prop == null ) {
          throw new MappingException(
              "property not known: " +
              persistentClass + '.' + propertyName
            );
        }
        return prop.getType();
      }
    };
  }
View Full Code Here

    boolean foundInsertGeneratedValue = false;
    boolean foundUpdateGeneratedValue = false;
    boolean foundUpdateableNaturalIdProperty = false;

    while ( iter.hasNext() ) {
      Property prop = ( Property ) iter.next();

      if ( prop == persistentClass.getVersion() ) {
        tempVersionProperty = i;
        properties[i] = PropertyFactory.buildVersionProperty( prop, lazyAvailable );
      }
      else {
        properties[i] = PropertyFactory.buildStandardProperty( prop, lazyAvailable );
      }

      if ( prop.isNaturalIdentifier() ) {
        naturalIdNumbers.add( i );
        if ( prop.isUpdateable() ) {
          foundUpdateableNaturalIdProperty = true;
        }
      }

      if ( "id".equals( prop.getName() ) ) {
        foundNonIdentifierPropertyNamedId = true;
      }

      // temporary ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      boolean lazy = prop.isLazy() && lazyAvailable;
      if ( lazy ) hasLazy = true;
      propertyLaziness[i] = lazy;

      propertyNames[i] = properties[i].getName();
      propertyTypes[i] = properties[i].getType();
View Full Code Here

TOP

Related Classes of org.hibernate.mapping.Property

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.