示例#1
0
  public ComponentType(TypeFactory.TypeScope typeScope, ComponentMetamodel metamodel) {
    this.typeScope = typeScope;
    // for now, just "re-flatten" the metamodel since this is temporary stuff anyway (HHH-1907)
    this.isKey = metamodel.isKey();
    this.propertySpan = metamodel.getPropertySpan();
    this.propertyNames = new String[propertySpan];
    this.propertyTypes = new Type[propertySpan];
    this.propertyValueGenerationStrategies = new ValueGeneration[propertySpan];
    this.propertyNullability = new boolean[propertySpan];
    this.cascade = new CascadeStyle[propertySpan];
    this.joinedFetch = new FetchMode[propertySpan];

    for (int i = 0; i < propertySpan; i++) {
      StandardProperty prop = metamodel.getProperty(i);
      this.propertyNames[i] = prop.getName();
      this.propertyTypes[i] = prop.getType();
      this.propertyNullability[i] = prop.isNullable();
      this.cascade[i] = prop.getCascadeStyle();
      this.joinedFetch[i] = prop.getFetchMode();
      if (!prop.isNullable()) {
        hasNotNullProperty = true;
      }
      this.propertyValueGenerationStrategies[i] = prop.getValueGenerationStrategy();
    }

    this.entityMode = metamodel.getEntityMode();
    this.componentTuplizer = metamodel.getComponentTuplizer();
  }
 private ValueInclusion determineUpdateValueGenerationType(
     Property mappingProperty, StandardProperty runtimeProperty) {
   if (runtimeProperty.isUpdateGenerated()) {
     return ValueInclusion.FULL;
   } else if (mappingProperty.getValue() instanceof Component) {
     if (hasPartialUpdateComponentGeneration((Component) mappingProperty.getValue())) {
       return ValueInclusion.PARTIAL;
     }
   }
   return ValueInclusion.NONE;
 }
 private ValueInclusion determineUpdateValueGenerationType(
     AttributeBinding mappingProperty, StandardProperty runtimeProperty) {
   if (runtimeProperty.isUpdateGenerated()) {
     return ValueInclusion.FULL;
   }
   // TODO: fix the following when components are working (HHH-6173)
   // else if ( mappingProperty.getValue() instanceof ComponentAttributeBinding ) {
   //	if ( hasPartialUpdateComponentGeneration( ( ComponentAttributeBinding )
   // mappingProperty.getValue() ) ) {
   //		return ValueInclusion.PARTIAL;
   //	}
   // }
   return ValueInclusion.NONE;
 }