Package org.hibernate.mapping

Examples of org.hibernate.mapping.Property


      jpaMappingType.getBuilder().applyIdClassAttributes( attributes );
    }
  }

  private <X> void applyVersionAttribute(PersistentClass persistentClass, EntityTypeImpl<X> jpaEntityType) {
    final Property declaredVersion = persistentClass.getDeclaredVersion();
    if (declaredVersion != null) {
      jpaEntityType.getBuilder().applyVersionAttribute(
          attributeFactory.buildVersionAttribute( jpaEntityType, declaredVersion )
      );
    }
View Full Code Here


      );
    }
  }

  private <X> void applyVersionAttribute(MappedSuperclass mappingType, MappedSuperclassTypeImpl<X> jpaMappingType) {
    final Property declaredVersion = mappingType.getDeclaredVersion();
    if ( declaredVersion != null ) {
      jpaMappingType.getBuilder().applyVersionAttribute(
          attributeFactory.buildVersionAttribute( jpaMappingType, declaredVersion )
      );
    }
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 entityName, String propertyName) throws MappingException {
        final PersistentClass pc = classes.get( entityName );
        if ( pc == null ) {
          throw new MappingException( "persistent class not known: " + entityName );
        }
        Property prop = pc.getReferencedProperty( propertyName );
        if ( prop == null ) {
          throw new MappingException(
              "property not known: " +
              entityName + '.' + propertyName
            );
        }
        return prop.getType();
      }
    };
  }
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

    else {
      id.setTypeUsingReflection( entity.getClassName(), propertyName );
    }

    if ( propertyName != null ) {
      Property prop = new Property();
      prop.setValue( id );
      bindProperty( idNode, prop, mappings, inheritedMetas );
      entity.setIdentifierProperty( prop );
      entity.setDeclaredIdentifierProperty( prop );
    }
View Full Code Here

         * entity.setIdentifierProperty(prop);
         */
      }
    }
    else {
      Property prop = new Property();
      prop.setValue( id );
      bindProperty( idNode, prop, mappings, inheritedMetas );
      entity.setIdentifierProperty( prop );
      entity.setDeclaredIdentifierProperty( prop );
    }

View Full Code Here

        else {
          val.setTypeName( "timestamp" );
        }
      }
    }
    Property prop = new Property();
    prop.setValue( val );
    bindProperty( subnode, prop, mappings, inheritedMetas );
    // for version properties marked as being generated, make sure they are "always"
    // generated; aka, "insert" is invalid; this is dis-allowed by the DTD,
    // but just to make sure...
    if ( prop.getValueGenerationStrategy() != null ) {
      if ( prop.getValueGenerationStrategy().getGenerationTiming() == GenerationTiming.INSERT ) {
        throw new MappingException( "'generated' attribute cannot be 'insert' for versioning property" );
      }
    }
    makeVersion( subnode, val );
    entity.setVersion( prop );
View Full Code Here

            false
          );
      }

      if ( value != null ) {
        Property prop = createProperty( value, propertyName, persistentClass
          .getEntityName(), subnode, mappings, inheritedMetas );
        prop.setOptional( join.isOptional() );
        join.addProperty( prop );
      }

    }
View Full Code Here

          mappings,
          inheritedMetas,
          true
        );
      persistentClass.setIdentifierMapper(mapper);
      Property property = new Property();
      property.setName( PropertyPath.IDENTIFIER_MAPPER_PROPERTY );
      property.setNodeName("id");
      property.setUpdateable(false);
      property.setInsertable(false);
      property.setValue(mapper);
      property.setPropertyAccessorName( "embedded" );
      persistentClass.addProperty(property);
    }

  }
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.