Package org.hibernate.mapping

Examples of org.hibernate.mapping.Property


  }

  private boolean hasPartialInsertComponentGeneration(Component component) {
    Iterator subProperties = component.getPropertyIterator();
    while ( subProperties.hasNext() ) {
      Property prop = ( Property ) subProperties.next();
      if ( prop.getGeneration() == PropertyGeneration.ALWAYS || prop.getGeneration() == PropertyGeneration.INSERT ) {
        return true;
      }
      else if ( prop.getValue() instanceof Component ) {
        if ( hasPartialInsertComponentGeneration( ( Component ) prop.getValue() ) ) {
          return true;
        }
      }
    }
    return false;
View Full Code Here


  }

  private boolean hasPartialUpdateComponentGeneration(Component component) {
    Iterator subProperties = component.getPropertyIterator();
    while ( subProperties.hasNext() ) {
      Property prop = ( Property ) subProperties.next();
      if ( prop.getGeneration() == PropertyGeneration.ALWAYS ) {
        return true;
      }
      else if ( prop.getValue() instanceof Component ) {
        if ( hasPartialUpdateComponentGeneration( ( Component ) prop.getValue() ) ) {
          return true;
        }
      }
    }
    return false;
View Full Code Here

  private void mapPropertyToIndex(Property prop, int i) {
    propertyIndexes.put( prop.getName(), i );
    if ( prop.getValue() instanceof Component ) {
      Iterator iter = ( (Component) prop.getValue() ).getPropertyIterator();
      while ( iter.hasNext() ) {
        Property subprop = (Property) iter.next();
        propertyIndexes.put(
            prop.getName() + '.' + subprop.getName(),
            i
          );
      }
    }
  }
View Full Code Here

    Iterator iter = mappingInfo.getPropertyClosureIterator();
    boolean foundCustomAccessor=false;
    int i=0;
    while ( iter.hasNext() ) {
      //TODO: redesign how PropertyAccessors are acquired...
      Property property = (Property) iter.next();
      getters[i] = buildPropertyGetter(property, mappingInfo);
      setters[i] = buildPropertySetter(property, mappingInfo);
      if ( !property.isBasicPropertyAccessor() ) foundCustomAccessor = true;
      i++;
    }
    hasCustomAccessors = foundCustomAccessor;

        instantiator = buildInstantiator( mappingInfo );
View Full Code Here

    iter = persistentClass.getPropertyClosureIterator();
    i = 0;
    boolean foundFormula = false;
    while ( iter.hasNext() ) {
      Property prop = ( Property ) iter.next();
      thisClassProperties.add( prop );

      int span = prop.getColumnSpan();
      propertyColumnSpans[i] = span;
      propertySubclassNames[i] = prop.getPersistentClass().getEntityName();
      String[] colNames = new String[span];
      String[] colAliases = new String[span];
      String[] templates = new String[span];
      Iterator colIter = prop.getColumnIterator();
      int k = 0;
      while ( colIter.hasNext() ) {
        Selectable thing = ( Selectable ) colIter.next();
        colAliases[k] = thing.getAlias( factory.getDialect() , prop.getValue().getTable() );
        if ( thing.isFormula() ) {
          foundFormula = true;
          templates[k] = thing.getTemplate( factory.getDialect(), factory.getSqlFunctionRegistry() );
        }
        else {
          colNames[k] = thing.getTemplate( factory.getDialect(), factory.getSqlFunctionRegistry() );
        }
        k++;
      }
      propertyColumnNames[i] = colNames;
      propertyColumnFormulaTemplates[i] = templates;
      propertyColumnAliases[i] = colAliases;

      if ( lazyAvailable && prop.isLazy() ) {
        lazyProperties.add( prop.getName() );
        lazyNames.add( prop.getName() );
        lazyNumbers.add( new Integer( i ) );
        lazyTypes.add( prop.getValue().getType() );
        lazyColAliases.add( colAliases );
      }

      propertyColumnUpdateable[i] = prop.getValue().getColumnUpdateability();
      propertyColumnInsertable[i] = prop.getValue().getColumnInsertability();

      propertySelectable[i] = prop.isSelectable();

      propertyUniqueness[i] = prop.getValue().isAlternateUniqueKey();

      i++;

    }
    hasFormulaProperties = foundFormula;
    lazyPropertyColumnAliases = ArrayHelper.to2DStringArray( lazyColAliases );
    lazyPropertyNames = ArrayHelper.toStringArray( lazyNames );
    lazyPropertyNumbers = ArrayHelper.toIntArray( lazyNumbers );
    lazyPropertyTypes = ArrayHelper.toTypeArray( lazyTypes );

    // SUBCLASS PROPERTY CLOSURE

    ArrayList columns = new ArrayList();
    ArrayList columnsLazy = new ArrayList();
    ArrayList aliases = new ArrayList();
    ArrayList formulas = new ArrayList();
    ArrayList formulaAliases = new ArrayList();
    ArrayList formulaTemplates = new ArrayList();
    ArrayList formulasLazy = new ArrayList();
    ArrayList types = new ArrayList();
    ArrayList names = new ArrayList();
    ArrayList classes = new ArrayList();
    ArrayList templates = new ArrayList();
    ArrayList propColumns = new ArrayList();
    ArrayList joinedFetchesList = new ArrayList();
    ArrayList cascades = new ArrayList();
    ArrayList definedBySubclass = new ArrayList();
    ArrayList propColumnNumbers = new ArrayList();
    ArrayList propFormulaNumbers = new ArrayList();
    ArrayList columnSelectables = new ArrayList();
    ArrayList propNullables = new ArrayList();

    iter = persistentClass.getSubclassPropertyClosureIterator();
    while ( iter.hasNext() ) {
      Property prop = ( Property ) iter.next();
      names.add( prop.getName() );
      classes.add( prop.getPersistentClass().getEntityName() );
      boolean isDefinedBySubclass = !thisClassProperties.contains( prop );
      definedBySubclass.add( Boolean.valueOf( isDefinedBySubclass ) );
      propNullables.add( Boolean.valueOf( prop.isOptional() || isDefinedBySubclass ) ); //TODO: is this completely correct?
      types.add( prop.getType() );

      Iterator colIter = prop.getColumnIterator();
      String[] cols = new String[prop.getColumnSpan()];
      String[] forms = new String[prop.getColumnSpan()];
      int[] colnos = new int[prop.getColumnSpan()];
      int[] formnos = new int[prop.getColumnSpan()];
      int l = 0;
      Boolean lazy = Boolean.valueOf( prop.isLazy() && lazyAvailable );
      while ( colIter.hasNext() ) {
        Selectable thing = ( Selectable ) colIter.next();
        if ( thing.isFormula() ) {
          String template = thing.getTemplate( factory.getDialect(), factory.getSqlFunctionRegistry() );
          formnos[l] = formulaTemplates.size();
          colnos[l] = -1;
          formulaTemplates.add( template );
          forms[l] = template;
          formulas.add( thing.getText( factory.getDialect() ) );
          formulaAliases.add( thing.getAlias( factory.getDialect() ) );
          formulasLazy.add( lazy );
        }
        else {
          String colName = thing.getTemplate( factory.getDialect(), factory.getSqlFunctionRegistry() );
          colnos[l] = columns.size(); //before add :-)
          formnos[l] = -1;
          columns.add( colName );
          cols[l] = colName;
          aliases.add( thing.getAlias( factory.getDialect(), prop.getValue().getTable() ) );
          columnsLazy.add( lazy );
          columnSelectables.add( Boolean.valueOf( prop.isSelectable() ) );
        }
        l++;
      }
      propColumns.add( cols );
      templates.add( forms );
      propColumnNumbers.add( colnos );
      propFormulaNumbers.add( formnos );

      joinedFetchesList.add( prop.getValue().getFetchMode() );
      cascades.add( prop.getCascadeStyle() );
    }
    subclassColumnClosure = ArrayHelper.toStringArray( columns );
    subclassColumnAliasClosure = ArrayHelper.toStringArray( aliases );
    subclassColumnLazyClosure = ArrayHelper.toBooleanArray( columnsLazy );
    subclassColumnSelectableClosure = ArrayHelper.toBooleanArray( columnSelectables );
View Full Code Here

    Iterator iter = component.getPropertyIterator();
    boolean foundCustomAccessor=false;
    int i = 0;
    while ( iter.hasNext() ) {
      Property prop = ( Property ) iter.next();
      getters[i] = buildGetter( component, prop );
      setters[i] = buildSetter( component, prop );
      if ( !prop.isBasicPropertyAccessor() ) {
        foundCustomAccessor = true;
      }
      i++;
    }
    hasCustomAccessors = foundCustomAccessor;
View Full Code Here

    this.lifecycleImplementor = Lifecycle.class.isAssignableFrom( mappedClass );
    this.validatableImplementor = Validatable.class.isAssignableFrom( mappedClass );

    Iterator iter = mappedEntity.getPropertyClosureIterator();
    while ( iter.hasNext() ) {
      Property property = (Property) iter.next();
      if ( property.isLazy() ) {
        lazyPropertyNames.add( property.getName() );
      }
    }

    String[] getterNames = new String[propertySpan];
    String[] setterNames = new String[propertySpan];
View Full Code Here

    }

    Iterator properties = persistentClass.getPropertyIterator();
    Class clazz = persistentClass.getMappedClass();
    while ( properties.hasNext() ) {
      Property property = (Property) properties.next();
      Method method = property.getGetter(clazz).getMethod();
      if ( method != null && Modifier.isFinal( method.getModifiers() ) ) {
        log.error(
            "Getters of lazy classes cannot be final: " + persistentClass.getEntityName() +
            "." + property.getName()
          );
      }
      method = property.getSetter(clazz).getMethod();
            if ( method != null && Modifier.isFinal( method.getModifiers() ) ) {
        log.error(
            "Setters of lazy classes cannot be final: " + persistentClass.getEntityName() +
            "." + property.getName()
          );
      }
    }

    Method idGetterMethod = idGetter==null ? null : idGetter.getMethod();
View Full Code Here

    propertySpan = component.getPropertySpan();
    properties = new StandardProperty[propertySpan];
    Iterator itr = component.getPropertyIterator();
    int i = 0;
    while ( itr.hasNext() ) {
      Property property = ( Property ) itr.next();
      properties[i] = PropertyFactory.buildStandardProperty( property, false );
      propertyIndexes.put( property.getName(), new Integer( i ) );
      i++;
    }

    tuplizerMapping = new ComponentEntityModeToTuplizerMapping( component );
  }
View Full Code Here

   */
  public static IdentifierProperty buildIdentifierProperty(PersistentClass mappedEntity, IdentifierGenerator generator) {

    String mappedUnsavedValue = mappedEntity.getIdentifier().getNullValue();
    Type type = mappedEntity.getIdentifier().getType();
    Property property = mappedEntity.getIdentifierProperty();
   
    IdentifierValue unsavedValue = UnsavedValueFactory.getUnsavedIdentifierValue(
        mappedUnsavedValue,
        getGetter( property ),
        type,
        getConstructor(mappedEntity)
      );

    if ( property == null ) {
      // this is a virtual id property...
      return new IdentifierProperty(
              type,
          mappedEntity.hasEmbeddedIdentifier(),
          mappedEntity.hasIdentifierMapper(),
          unsavedValue,
          generator
        );
    }
    else {
      return new IdentifierProperty(
          property.getName(),
          property.getNodeName(),
          type,
          mappedEntity.hasEmbeddedIdentifier(),
          unsavedValue,
          generator
        );
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.