Search in sources :

Example 1 with PrimaryKeyForeignKeyMetadata

use of org.eclipse.persistence.internal.jpa.metadata.columns.PrimaryKeyForeignKeyMetadata in project eclipselink by eclipse-ee4j.

the class EntityImpl method setPrimaryKeyForeignKey.

@Override
public ForeignKey setPrimaryKeyForeignKey() {
    ForeignKeyImpl foreignKey = new ForeignKeyImpl();
    getMetadata().setPrimaryKeyForeignKey(new PrimaryKeyForeignKeyMetadata(foreignKey.getMetadata()));
    return foreignKey;
}
Also used : PrimaryKeyForeignKeyMetadata(org.eclipse.persistence.internal.jpa.metadata.columns.PrimaryKeyForeignKeyMetadata) ForeignKeyImpl(org.eclipse.persistence.internal.jpa.config.columns.ForeignKeyImpl)

Example 2 with PrimaryKeyForeignKeyMetadata

use of org.eclipse.persistence.internal.jpa.metadata.columns.PrimaryKeyForeignKeyMetadata in project eclipselink by eclipse-ee4j.

the class EntityAccessor method processInheritancePrimaryKeyJoinColumns.

/**
 * INTERNAL:
 * Process the inheritance metadata for an inheritance subclass. The
 * parent descriptor must be provided.
 */
public void processInheritancePrimaryKeyJoinColumns() {
    // some defined through annotations.
    if (m_primaryKeyJoinColumns.isEmpty()) {
        // Process all the primary key join columns first.
        if (isAnnotationPresent(JPA_PRIMARY_KEY_JOIN_COLUMNS)) {
            MetadataAnnotation primaryKeyJoinColumns = getAnnotation(JPA_PRIMARY_KEY_JOIN_COLUMNS);
            for (Object primaryKeyJoinColumn : primaryKeyJoinColumns.getAttributeArray("value")) {
                m_primaryKeyJoinColumns.add(new PrimaryKeyJoinColumnMetadata((MetadataAnnotation) primaryKeyJoinColumn, this));
            }
            // Set the primary key foreign key metadata if one is specified.
            if (primaryKeyJoinColumns.hasAttribute("foreignKey")) {
                setPrimaryKeyForeignKey(new PrimaryKeyForeignKeyMetadata(primaryKeyJoinColumns.getAttributeAnnotation("foreignKey"), this));
            }
        }
        // Process the single primary key join column second.
        if (isAnnotationPresent(JPA_PRIMARY_KEY_JOIN_COLUMN)) {
            PrimaryKeyJoinColumnMetadata primaryKeyJoinColumn = new PrimaryKeyJoinColumnMetadata(getAnnotation(JPA_PRIMARY_KEY_JOIN_COLUMN), this);
            m_primaryKeyJoinColumns.add(primaryKeyJoinColumn);
            // Set the primary key foreign key metadata if specified.
            if (primaryKeyJoinColumn.hasForeignKey()) {
                setPrimaryKeyForeignKey(new PrimaryKeyForeignKeyMetadata(primaryKeyJoinColumn.getForeignKey()));
            }
        }
    }
    // Process the primary key join columns into multiple table key fields.
    addMultipleTableKeyFields(m_primaryKeyJoinColumns, getDescriptor().getPrimaryTable(), MetadataLogger.INHERITANCE_PK_COLUMN, MetadataLogger.INHERITANCE_FK_COLUMN);
    // Process the primary key foreign key.
    if (m_primaryKeyForeignKey != null) {
        m_primaryKeyForeignKey.process(getDescriptor().getPrimaryTable());
    }
}
Also used : PrimaryKeyForeignKeyMetadata(org.eclipse.persistence.internal.jpa.metadata.columns.PrimaryKeyForeignKeyMetadata) PrimaryKeyJoinColumnMetadata(org.eclipse.persistence.internal.jpa.metadata.columns.PrimaryKeyJoinColumnMetadata) MetadataAccessibleObject(org.eclipse.persistence.internal.jpa.metadata.accessors.objects.MetadataAccessibleObject) MetadataAnnotation(org.eclipse.persistence.internal.jpa.metadata.accessors.objects.MetadataAnnotation)

Example 3 with PrimaryKeyForeignKeyMetadata

use of org.eclipse.persistence.internal.jpa.metadata.columns.PrimaryKeyForeignKeyMetadata in project eclipselink by eclipse-ee4j.

the class SecondaryTableImpl method setPrimaryKeyForeignKey.

@Override
public ForeignKey setPrimaryKeyForeignKey() {
    ForeignKeyImpl foreignKey = new ForeignKeyImpl();
    getMetadata().setPrimaryKeyForeignKey(new PrimaryKeyForeignKeyMetadata(foreignKey.getMetadata()));
    return foreignKey;
}
Also used : PrimaryKeyForeignKeyMetadata(org.eclipse.persistence.internal.jpa.metadata.columns.PrimaryKeyForeignKeyMetadata) ForeignKeyImpl(org.eclipse.persistence.internal.jpa.config.columns.ForeignKeyImpl)

Example 4 with PrimaryKeyForeignKeyMetadata

use of org.eclipse.persistence.internal.jpa.metadata.columns.PrimaryKeyForeignKeyMetadata in project eclipselink by eclipse-ee4j.

the class OneToOneImpl method setPrimaryKeyForeignKey.

@Override
public ForeignKey setPrimaryKeyForeignKey() {
    ForeignKeyImpl foreignKey = new ForeignKeyImpl();
    getMetadata().setPrimaryKeyForeignKey(new PrimaryKeyForeignKeyMetadata(foreignKey.getMetadata()));
    return foreignKey;
}
Also used : PrimaryKeyForeignKeyMetadata(org.eclipse.persistence.internal.jpa.metadata.columns.PrimaryKeyForeignKeyMetadata) ForeignKeyImpl(org.eclipse.persistence.internal.jpa.config.columns.ForeignKeyImpl)

Aggregations

PrimaryKeyForeignKeyMetadata (org.eclipse.persistence.internal.jpa.metadata.columns.PrimaryKeyForeignKeyMetadata)4 ForeignKeyImpl (org.eclipse.persistence.internal.jpa.config.columns.ForeignKeyImpl)3 MetadataAccessibleObject (org.eclipse.persistence.internal.jpa.metadata.accessors.objects.MetadataAccessibleObject)1 MetadataAnnotation (org.eclipse.persistence.internal.jpa.metadata.accessors.objects.MetadataAnnotation)1 PrimaryKeyJoinColumnMetadata (org.eclipse.persistence.internal.jpa.metadata.columns.PrimaryKeyJoinColumnMetadata)1