Java 类javax.persistence.AssociationOverride 实例源码

项目:lams    文件:JPAOverriddenAnnotationReader.java   
/**
 * @param mergeWithAnnotations Whether to use Java annotations for this
 * element, if present and not disabled by the XMLContext defaults.
 * In some contexts (such as an element-collection mapping) merging
 * with annotations is never allowed.
 */
private AssociationOverrides getAssociationOverrides(Element tree, XMLContext.Default defaults, boolean mergeWithAnnotations) {
    List<AssociationOverride> attributes = buildAssociationOverrides( tree, defaults );
    if ( mergeWithAnnotations && defaults.canUseJavaAnnotations() ) {
        AssociationOverride annotation = getPhysicalAnnotation( AssociationOverride.class );
        addAssociationOverrideIfNeeded( annotation, attributes );
        AssociationOverrides annotations = getPhysicalAnnotation( AssociationOverrides.class );
        if ( annotations != null ) {
            for ( AssociationOverride current : annotations.value() ) {
                addAssociationOverrideIfNeeded( current, attributes );
            }
        }
    }
    if ( attributes.size() > 0 ) {
        AnnotationDescriptor ad = new AnnotationDescriptor( AssociationOverrides.class );
        ad.setValue( "value", attributes.toArray( new AssociationOverride[attributes.size()] ) );
        return AnnotationFactory.create( ad );
    }
    else {
        return null;
    }
}
项目:lams    文件:JPAOverriddenAnnotationReader.java   
private List<AssociationOverride> buildAssociationOverrides(Element element, XMLContext.Default defaults) {
    List<Element> subelements = element == null ? null : element.elements( "association-override" );
    List<AssociationOverride> overrides = new ArrayList<AssociationOverride>();
    if ( subelements != null && subelements.size() > 0 ) {
        for ( Element current : subelements ) {
            AnnotationDescriptor override = new AnnotationDescriptor( AssociationOverride.class );
            copyStringAttribute( override, current, "name", true );
            override.setValue( "joinColumns", getJoinColumns( current, false ) );
            JoinTable joinTable = buildJoinTable( current, defaults );
            if ( joinTable != null ) {
                override.setValue( "joinTable", joinTable );
            }
            overrides.add( (AssociationOverride) AnnotationFactory.create( override ) );
        }
    }
    return overrides;
}
项目:org.fastnate    文件:EntityClass.java   
/**
 * Builds the property for the given attribute.
 *
 * @param attribute
 *            the attribute to inspect
 * @param columnMetadata
 *            the attached (or overriden) column metadata
 * @param override
 *            the AssociationOverride found for this attribute
 * @return the property that represents the attribute or {@code null} if not persistent
 */
<X> Property<X, ?> buildProperty(final AttributeAccessor attribute, final Column columnMetadata,
        final AssociationOverride override) {
    if (attribute.isPersistent()) {
        if (CollectionProperty.isCollectionProperty(attribute)) {
            return new CollectionProperty<>(this, attribute, override);
        } else if (MapProperty.isMapProperty(attribute)) {
            return new MapProperty<>(this, attribute, override);
        } else if (EntityProperty.isEntityProperty(attribute)) {
            return new EntityProperty<>(this.context, getTable(), attribute, override);
        } else if (attribute.isAnnotationPresent(Embedded.class)) {
            return new EmbeddedProperty<>(this, attribute);
        } else if (attribute.isAnnotationPresent(Version.class)) {
            return new VersionProperty<>(this.context, this.table, attribute, columnMetadata);
        } else {
            return new PrimitiveProperty<>(this.context, this.table, attribute, columnMetadata);
        }
    }
    return null;
}
项目:org.fastnate    文件:PluralProperty.java   
/**
 * Builds the name of the table of the association for the given field.
 *
 * @param attribute
 *            the inspected field
 * @param override
 *            contains optional override options
 * @param joinTable
 *            the optional join table
 * @param collectionTable
 *            the optional metadata of the table
 * @param defaultTableName
 *            the default name for the table
 * @return the table name
 */
protected static String buildTableName(final AttributeAccessor attribute, final AssociationOverride override,
        final JoinTable joinTable, final CollectionTable collectionTable, final String defaultTableName) {
    if (override != null) {
        final JoinTable joinTableOverride = override.joinTable();
        if (joinTableOverride != null && joinTableOverride.name().length() > 0) {
            return joinTableOverride.name();
        }
    }
    if (joinTable != null && joinTable.name().length() > 0) {
        return joinTable.name();
    }
    if (collectionTable != null && collectionTable.name().length() > 0) {
        return collectionTable.name();
    }
    return defaultTableName;
}
项目:lams    文件:AbstractPropertyHolder.java   
private static Map<String, JoinColumn[]> buildJoinColumnOverride(XAnnotatedElement element, String path) {
    Map<String, JoinColumn[]> columnOverride = new HashMap<String, JoinColumn[]>();
    if ( element == null ) return columnOverride;
    AssociationOverride singleOverride = element.getAnnotation( AssociationOverride.class );
    AssociationOverrides multipleOverrides = element.getAnnotation( AssociationOverrides.class );
    AssociationOverride[] overrides;
    if ( singleOverride != null ) {
        overrides = new AssociationOverride[] { singleOverride };
    }
    else if ( multipleOverrides != null ) {
        overrides = multipleOverrides.value();
    }
    else {
        overrides = null;
    }

    //fill overridden columns
    if ( overrides != null ) {
        for (AssociationOverride depAttr : overrides) {
            columnOverride.put(
                    StringHelper.qualify( path, depAttr.name() ),
                    depAttr.joinColumns()
            );
        }
    }
    return columnOverride;
}
项目:lams    文件:AbstractPropertyHolder.java   
private static Map<String, JoinTable> buildJoinTableOverride(XAnnotatedElement element, String path) {
    Map<String, JoinTable> tableOverride = new HashMap<String, JoinTable>();
    if ( element == null ) return tableOverride;
    AssociationOverride singleOverride = element.getAnnotation( AssociationOverride.class );
    AssociationOverrides multipleOverrides = element.getAnnotation( AssociationOverrides.class );
    AssociationOverride[] overrides;
    if ( singleOverride != null ) {
        overrides = new AssociationOverride[] { singleOverride };
    }
    else if ( multipleOverrides != null ) {
        overrides = multipleOverrides.value();
    }
    else {
        overrides = null;
    }

    //fill overridden tables
    if ( overrides != null ) {
        for (AssociationOverride depAttr : overrides) {
            if ( depAttr.joinColumns().length == 0 ) {
                tableOverride.put(
                        StringHelper.qualify( path, depAttr.name() ),
                        depAttr.joinTable()
                );
            }
        }
    }
    return tableOverride;
}
项目:lams    文件:JPAOverriddenAnnotationReader.java   
private void addAssociationOverrideIfNeeded(AssociationOverride annotation, List<AssociationOverride> overrides) {
    if ( annotation != null ) {
        String overrideName = annotation.name();
        boolean present = false;
        for ( AssociationOverride current : overrides ) {
            if ( current.name().equals( overrideName ) ) {
                present = true;
                break;
            }
        }
        if ( !present ) {
            overrides.add( annotation );
        }
    }
}
项目:Harvest-JP    文件:IdoDataU.java   
@EmbeddedId
   @AssociationOverrides({
       @AssociationOverride(name = "pk.organization", joinColumns = @JoinColumn(name = "StrCode")),
       @AssociationOverride(name = "pk.getSudo", joinColumns = @JoinColumn(name = "GetSudo")),
       @AssociationOverride(name = "pk.bunruiKbn", joinColumns = @JoinColumn(name = "BunruiKbn"))
   })
public ClassificationCategoryIdentifier getPk() {
    return pk;
}
项目:Harvest-JP    文件:KtData.java   
@EmbeddedId
   @AssociationOverrides({
       @AssociationOverride(name = "pk.organization", joinColumns = @JoinColumn(name = "StrCode")),
       @AssociationOverride(name = "pk.getSudo", joinColumns = @JoinColumn(name = "GetSudo")),
       @AssociationOverride(name = "pk.bunruiKbn", joinColumns = @JoinColumn(name = "BunruiKbn"))
   })
public ClassificationCategoryIdentifier getPk() {
    return pk;
}
项目:Harvest-JP    文件:MenuD.java   
@EmbeddedId
@AssociationOverrides({
    @AssociationOverride(name = "pk.parent", joinColumns = @JoinColumn(name = "ProGNo")),
    @AssociationOverride(name = "pk.srProNo", joinColumns = @JoinColumn(name = "SrProNo"))
})
public MenuIdentifier getPk() {
    return pk;
}
项目:Harvest-JP    文件:BudgetPerformanceWorktable.java   
@EmbeddedId
   @AssociationOverrides({
       @AssociationOverride(name = "pk.organization", joinColumns = @JoinColumn(name = "StrCode")),
       @AssociationOverride(name = "pk.account", joinColumns = @JoinColumn(name = "KmkCode"))
   })
public BudgetPerformanceWorktableIdentifier getPk() {
    return pk;
}
项目:Harvest-JP    文件:UriDataM.java   
@EmbeddedId
   @AssociationOverrides({
       @AssociationOverride(name = "pk.organization", joinColumns = @JoinColumn(name = "StrCode")),
       @AssociationOverride(name = "pk.getSudo", joinColumns = @JoinColumn(name = "GetSudo")),
       @AssociationOverride(name = "pk.bunruiKbn", joinColumns = @JoinColumn(name = "BunruiKbn"))
   })
public ClassificationCategoryIdentifier getPk() {
    return pk;
}
项目:Harvest-JP    文件:UriDataSK.java   
@EmbeddedId
   @AssociationOverrides({
       @AssociationOverride(name = "pk.organization", joinColumns = @JoinColumn(name = "StrCode")),
       @AssociationOverride(name = "pk.getSudo", joinColumns = @JoinColumn(name = "GetSudo"))
   })
public ClassificationCategoryWithoutBunruiKbnIdentifier getPk() {
    return pk;
}
项目:Harvest-JP    文件:Stamp.java   
@EmbeddedId
   @AssociationOverrides({
       @AssociationOverride(name = "pk.organization", joinColumns = @JoinColumn(name = "StrCode")),
       @AssociationOverride(name = "pk.srDate", joinColumns = @JoinColumn(name = "SrDate"))
   })
public StampAndLaborCostIdentifier getPk() {
    return pk;
}
项目:Harvest-JP    文件:UriDataKR.java   
@EmbeddedId
   @AssociationOverrides({
       @AssociationOverride(name = "pk.organization", joinColumns = @JoinColumn(name = "StrCode")),
       @AssociationOverride(name = "pk.getSudo", joinColumns = @JoinColumn(name = "GetSudo"))
   })
public ClassificationCategoryWithoutBunruiKbnIdentifier getPk() {
    return pk;
}
项目:Harvest-JP    文件:IdoDataH.java   
@EmbeddedId
   @AssociationOverrides({
       @AssociationOverride(name = "pk.organization", joinColumns = @JoinColumn(name = "StrCode")),
       @AssociationOverride(name = "pk.getSudo", joinColumns = @JoinColumn(name = "GetSudo")),
       @AssociationOverride(name = "pk.bunruiKbn", joinColumns = @JoinColumn(name = "BunruiKbn"))
   })
public ClassificationCategoryIdentifier getPk() {
    return pk;
}
项目:Harvest-JP    文件:FixedSystemCostWorktable.java   
@EmbeddedId
   @AssociationOverrides({
       @AssociationOverride(name = "pk.organization", joinColumns = @JoinColumn(name = "StrCode")),
       @AssociationOverride(name = "pk.getSudo", joinColumns = @JoinColumn(name = "GetSudo")),
       @AssociationOverride(name = "pk.account", joinColumns = @JoinColumn(name = "KmkCode"))
   })
public FixedSystemCostWorktableIdentifier getPk() {
    return pk;
}
项目:Harvest-JP    文件:SectorVendor.java   
@EmbeddedId
   @AssociationOverrides({
       @AssociationOverride(name = "pk.organization", joinColumns = @JoinColumn(name = "StrCode")),
       @AssociationOverride(name = "pk.vendor", joinColumns = @JoinColumn(name = "SrsCode")),
       @AssociationOverride(name = "pk.category", joinColumns = @JoinColumn(name = "CtgCode"))
   })
public SectorVendorIdentifier getPk() {
    return pk;
}
项目:Harvest-JP    文件:KnData.java   
@EmbeddedId
   @AssociationOverrides({
       @AssociationOverride(name = "pk.organization", joinColumns = @JoinColumn(name = "StrCode")),
       @AssociationOverride(name = "pk.getSudo", joinColumns = @JoinColumn(name = "GetSudo")),
       @AssociationOverride(name = "pk.bunruiKbn", joinColumns = @JoinColumn(name = "BunruiKbn"))
   })
public ClassificationCategoryIdentifier getPk() {
    return pk;
}
项目:Harvest-JP    文件:VJiseki.java   
@EmbeddedId
   @AssociationOverrides({
       @AssociationOverride(name = "pk.organization", joinColumns = @JoinColumn(name = "StrCode", columnDefinition = "TINYINT")),
       @AssociationOverride(name = "pk.getSudo", joinColumns = @JoinColumn(name = "GetSudo", columnDefinition = "TINYINT"))
   })
public ClassificationCategoryWithoutBunruiKbnIdentifier getPk() {
    return pk;
}
项目:Harvest-JP    文件:HelpDataH.java   
@EmbeddedId
   @AssociationOverrides({
       @AssociationOverride(name = "pk.organization", joinColumns = @JoinColumn(name = "StrCode")),
       @AssociationOverride(name = "pk.getSudo", joinColumns = @JoinColumn(name = "GetSudo")),
       @AssociationOverride(name = "pk.bunruiKbn", joinColumns = @JoinColumn(name = "BunruiKbn"))
   })
public ClassificationCategoryIdentifier getPk() {
    return pk;
}
项目:Harvest-JP    文件:LaborCostWorktable.java   
@EmbeddedId
   @AssociationOverrides({
       @AssociationOverride(name = "pk.organization", joinColumns = @JoinColumn(name = "StrCode")),
       @AssociationOverride(name = "pk.jinjiKbn", joinColumns = @JoinColumn(name = "JinjiKbn")),
       @AssociationOverride(name = "pk.shoriDate", joinColumns = @JoinColumn(name = "ShoriDate"))
   })
public LaborCostWorktableIdentifier getPk() {
    return pk;
}
项目:Harvest-JP    文件:Cash.java   
@EmbeddedId
@AssociationOverrides({
    @AssociationOverride(name = "pk.organization", joinColumns = @JoinColumn(name = "StrCode")),
    @AssociationOverride(name = "pk.getSudo", joinColumns = @JoinColumn(name = "GetSudo")),
    @AssociationOverride(name = "pk.srDate", joinColumns = @JoinColumn(name = "SrDate"))
})
public SalesChangeIdentifier getPk() {
    return pk;
}
项目:Harvest-JP    文件:SalesFixed.java   
@EmbeddedId
@AssociationOverrides({
        @AssociationOverride(name = "pk.organization", joinColumns = @JoinColumn(name = "StrCode")),
        @AssociationOverride(name = "pk.getSudo", joinColumns = @JoinColumn(name = "GetSudo")) })
public SalesFixedIdentifier getPk() {
    return pk;
}
项目:Harvest-JP    文件:HelpDataU.java   
@EmbeddedId
   @AssociationOverrides({
       @AssociationOverride(name = "pk.organization", joinColumns = @JoinColumn(name = "StrCode")),
       @AssociationOverride(name = "pk.getSudo", joinColumns = @JoinColumn(name = "GetSudo")),
       @AssociationOverride(name = "pk.bunruiKbn", joinColumns = @JoinColumn(name = "BunruiKbn"))
   })
public ClassificationCategoryIdentifier getPk() {
    return pk;
}
项目:Harvest-JP    文件:StrokesLeakageTimeWorktable.java   
@EmbeddedId
   @AssociationOverrides({
       @AssociationOverride(name = "pk.organization", joinColumns = @JoinColumn(name = "StrCode")),
       @AssociationOverride(name = "pk.kojinCode", joinColumns = @JoinColumn(name = "KojinCode")),
       @AssociationOverride(name = "pk.shoriDate", joinColumns = @JoinColumn(name = "ShoriDate"))
   })
public StrokesLeakageTimeWorktableIdentifier getPk() {
    return pk;
}
项目:Harvest-JP    文件:BudgetPerformance.java   
@EmbeddedId
   @AssociationOverrides({
       @AssociationOverride(name = "pk.organization", joinColumns = @JoinColumn(name = "StrCode")),
       @AssociationOverride(name = "pk.getSudo", joinColumns = @JoinColumn(name = "GetSudo")),
       @AssociationOverride(name = "pk.kmkCodeJ", joinColumns = @JoinColumn(name = "KmkCodeJ"))
   })
public BudgetPerformanceIdentifier getPk() {
    return pk;
}
项目:Harvest-JP    文件:Purchase.java   
@EmbeddedId
@AssociationOverrides({
    @AssociationOverride(name = "pk.organization", joinColumns = @JoinColumn(name = "StrCode")),
    @AssociationOverride(name = "pk.getSudo", joinColumns = @JoinColumn(name = "GetSudo")),
    @AssociationOverride(name = "pk.srDate", joinColumns = @JoinColumn(name = "SrDate")),
    @AssociationOverride(name = "pk.vendor", joinColumns = @JoinColumn(name = "SrsCode")),
    @AssociationOverride(name = "pk.category", joinColumns = @JoinColumn(name = "CtgCode")),
    @AssociationOverride(name = "pk.wakuNum", joinColumns = @JoinColumn(name = "WakuNum"))
})
public PurchaseIdentifier getPk() {
    return pk;
}
项目:Harvest-JP    文件:KnDataM.java   
@EmbeddedId
   @AssociationOverrides({
       @AssociationOverride(name = "pk.organization", joinColumns = @JoinColumn(name = "StrCode")),
       @AssociationOverride(name = "pk.getSudo", joinColumns = @JoinColumn(name = "GetSudo")),
       @AssociationOverride(name = "pk.bunruiKbn", joinColumns = @JoinColumn(name = "BunruiKbn"))
   })
public ClassificationCategoryIdentifier getPk() {
    return pk;
}
项目:Harvest-JP    文件:Inventory.java   
@EmbeddedId
@AssociationOverrides({
    @AssociationOverride(name = "pk.organization", joinColumns = @JoinColumn(name = "StrCode")),
    @AssociationOverride(name = "pk.getSudo", joinColumns = @JoinColumn(name = "GetSudo")),
    @AssociationOverride(name = "pk.category", joinColumns = @JoinColumn(name = "CtgCode"))
})
public InventoryIdentifier getPk() {
    return pk;
}
项目:Harvest-JP    文件:MonthlyPurchase.java   
@EmbeddedId
   @AssociationOverrides({
       @AssociationOverride(name = "pk.organization", joinColumns = @JoinColumn(name = "StrCode")),
       @AssociationOverride(name = "pk.getSudo", joinColumns = @JoinColumn(name = "GetSudo")),
       @AssociationOverride(name = "pk.vendor", joinColumns = @JoinColumn(name = "SrsCode")),
       @AssociationOverride(name = "pk.category", joinColumns = @JoinColumn(name = "CtgCode"))
   })
public MonthlyPurchaseIdentifier getPk() {
    return pk;
}
项目:Harvest-JP    文件:LaborCost.java   
@EmbeddedId
   @AssociationOverrides({
       @AssociationOverride(name = "pk.organization", joinColumns = @JoinColumn(name = "StrCode")),
       @AssociationOverride(name = "pk.srDate", joinColumns = @JoinColumn(name = "SrDate"))
   })
public StampAndLaborCostIdentifier getPk() {
    return pk;
}
项目:Harvest-JP    文件:KgcData.java   
@EmbeddedId
   @AssociationOverrides({
       @AssociationOverride(name = "pk.organization", joinColumns = @JoinColumn(name = "StrCode")),
       @AssociationOverride(name = "pk.getSudo", joinColumns = @JoinColumn(name = "GetSudo")),
       @AssociationOverride(name = "pk.bunruiKbn", joinColumns = @JoinColumn(name = "BunruiKbn"))
   })
public ClassificationCategoryIdentifier getPk() {
    return pk;
}
项目:Harvest-JP    文件:VJkData.java   
@EmbeddedId
   @AssociationOverrides({
       @AssociationOverride(name = "pk.organization", joinColumns = @JoinColumn(name = "StrCode")),
       @AssociationOverride(name = "pk.getSudo", joinColumns = @JoinColumn(name = "GetSudo"))
   })
public ClassificationCategoryWithoutBunruiKbnIdentifier getPk() {
    return pk;
}
项目:Harvest-JP    文件:MonthlySales.java   
@EmbeddedId
   @AssociationOverrides({
       @AssociationOverride(name = "pk.organization", joinColumns = @JoinColumn(name = "StrCode")),
       @AssociationOverride(name = "pk.getSudo", joinColumns = @JoinColumn(name = "GetSudo")),
       @AssociationOverride(name = "pk.ugKbn", joinColumns = @JoinColumn(name = "UgKbn")),
       @AssociationOverride(name = "pk.category", joinColumns = @JoinColumn(name = "CtgCode"))
   })
public MonthlySalesIdentifier getPk() {
    return pk;
}
项目:Harvest-JP    文件:SalesChange.java   
@EmbeddedId
@AssociationOverrides({
    @AssociationOverride(name = "pk.organization", joinColumns = @JoinColumn(name = "StrCode")),
    @AssociationOverride(name = "pk.getSudo", joinColumns = @JoinColumn(name = "GetSudo")),
    @AssociationOverride(name = "pk.srDate", joinColumns = @JoinColumn(name = "SrDate"))
})
public SalesChangeIdentifier getPk() {
    return pk;
}
项目:org.fastnate    文件:EntityClass.java   
/**
 * Funds all association overrides that are attached to the given field or class.
 *
 * @param fieldOrClass
 *            the annotated element
 * @return a mapping from the name of the override to its definition, empty if neither {@link AssociationOverrides}
 *         nor {@link AssociationOverride} are given
 */
static Map<String, AssociationOverride> getAccociationOverrides(final AnnotatedElement fieldOrClass) {
    final AssociationOverrides multiOverride = fieldOrClass.getAnnotation(AssociationOverrides.class);
    final AssociationOverride singleOverride = fieldOrClass.getAnnotation(AssociationOverride.class);

    if (multiOverride == null && singleOverride == null) {
        return Collections.emptyMap();
    }

    final Collection<AssociationOverride> config = new ArrayList<>();

    // Multi annotation
    if (multiOverride != null) {
        config.addAll(Arrays.asList(multiOverride.value()));
    }

    // Single annotion
    if (singleOverride != null) {
        config.add(singleOverride);
    }

    final Map<String, AssociationOverride> attributeOverrides = new HashMap<>();
    for (final AssociationOverride override : config) {
        attributeOverrides.put(override.name(), override);
    }
    return attributeOverrides;
}
项目:org.fastnate    文件:CollectionProperty.java   
/**
 * Creates a new collection property.
 *
 * @param sourceClass
 *            the description of the current inspected class that contains this property
 * @param attribute
 *            accessor to the represented attribute
 * @param override
 *            the configured assocation override
 */
public CollectionProperty(final EntityClass<?> sourceClass, final AttributeAccessor attribute,
        final AssociationOverride override) {
    super(sourceClass, attribute, override, 0);

    // Read a potentially defined order column
    final OrderColumn orderColumnDef = attribute.getAnnotation(OrderColumn.class);
    this.orderColumn = orderColumnDef == null ? null
            : getTable().resolveColumn(
                    orderColumnDef.name().length() == 0 ? attribute.getName() + "_ORDER" : orderColumnDef.name());
}
项目:org.fastnate    文件:EmbeddedProperty.java   
/**
 * Instantiates a new embedded property.
 *
 * @param entityClass
 *            the class of the entity
 * @param attribute
 *            the attribute that contains the embedded object
 */
public EmbeddedProperty(final EntityClass<?> entityClass, final AttributeAccessor attribute) {
    super(attribute);

    this.id = attribute.isAnnotationPresent(EmbeddedId.class);

    final Class<?> type = attribute.getType();
    if (!type.isAnnotationPresent(Embeddable.class)) {
        throw new IllegalArgumentException(attribute + " does reference " + type + " which is not embeddable.");
    }

    // Determine the access style
    final AccessStyle accessStyle;
    final Access accessType = type.getAnnotation(Access.class);
    if (accessType != null) {
        accessStyle = AccessStyle.getStyle(accessType.value());
    } else {
        accessStyle = attribute.getAccessStyle();
    }

    final Map<String, AttributeOverride> attributeOverrides = EntityClass
            .getAttributeOverrides(attribute.getElement());
    final Map<String, AssociationOverride> accociationOverrides = EntityClass
            .getAccociationOverrides(attribute.getElement());
    for (final AttributeAccessor field : accessStyle.getDeclaredAttributes((Class<Object>) type, type)) {
        final AttributeOverride attrOveride = attributeOverrides.get(field.getName());
        final Property<T, ?> property = entityClass.buildProperty(field,
                attrOveride != null ? attrOveride.column() : field.getAnnotation(Column.class),
                accociationOverrides.get(field.getName()));
        if (property != null) {
            this.embeddedProperties.put(field.getName(), property);
        }
    }
}
项目:org.fastnate    文件:EntityProperty.java   
/**
 * Creates a new instance of {@link EntityProperty}.
 *
 * @param context
 *            the generator context.
 * @param containerTable
 *            the table that contains our column
 * @param attribute
 *            the accessor of the attribute
 * @param override
 *            optional {@link AttributeOverride} configuration.
 */
public EntityProperty(final GeneratorContext context, final GeneratorTable containerTable,
        final AttributeAccessor attribute, @Nullable final AssociationOverride override) {
    super(attribute);
    this.context = context;

    // Initialize the target class description
    this.targetClass = context.getDescription((Class<T>) attribute.getType());

    // Initialize according to the *ToOne annotations
    final MappingInformation mapping = new MappingInformation(attribute);
    this.required = !mapping.isOptional();
    this.mappedBy = mapping.getMappedBy().length() == 0 ? null : mapping.getMappedBy();
    final MapsId mapsId = attribute.getAnnotation(MapsId.class);
    this.idField = mapsId != null ? mapsId.value() : null;

    // Initialize the column name
    if (this.mappedBy == null) {
        final JoinColumn joinColumn = override != null && override.joinColumns().length > 0
                ? override.joinColumns()[0]
                : attribute.getAnnotation(JoinColumn.class);
        if (joinColumn != null && joinColumn.name().length() > 0) {
            this.column = containerTable.resolveColumn(joinColumn.name());
        } else {
            this.column = containerTable.resolveColumn(attribute.getName() + "_"
                    + (this.targetClass == null ? "id" : this.targetClass.getIdColumn(attribute)));
        }
    } else {
        this.column = null;
    }

    // Initialize ANY meta information
    final String anyColumnName = mapping.getAnyMetaColumn();
    if (anyColumnName != null) {
        this.anyColumn = containerTable.resolveColumn(anyColumnName);
        fillMetaDefs(attribute, context.getDialect());
    } else {
        this.anyColumn = null;
    }
}