Search in sources :

Example 1 with ColumnMetadata

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

the class SerializedObjectPolicyMetadata method initXMLObject.

/**
 * INTERNAL:
 */
@Override
public void initXMLObject(MetadataAccessibleObject accessibleObject, XMLEntityMappings entityMappings) {
    super.initXMLObject(accessibleObject, entityMappings);
    m_class = initXMLClassName(m_className);
    initXMLObject(m_column, accessibleObject);
    if (m_column == null) {
        // This should be kept in sync with SerializedObject.column default
        m_column = new ColumnMetadata();
        m_column.setName("SOP");
    }
}
Also used : ColumnMetadata(org.eclipse.persistence.internal.jpa.metadata.columns.ColumnMetadata)

Example 2 with ColumnMetadata

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

the class MappingAccessor method getDatabaseField.

/**
 * INTERNAL:
 * Process column metadata details into a database field. This will set
 * correct metadata and log defaulting messages to the user. It also looks
 * for an attribute override.
 *
 * This method will call getColumn() which assumes the subclasses will
 * return the appropriate ColumnMetadata to process based on the context
 * provided.
 *
 * @see BasicCollectionAccessor
 * @see BasicMapAccessor
 */
protected DatabaseField getDatabaseField(DatabaseTable defaultTable, String loggingCtx) {
    // Check if we have an attribute override first, otherwise process for a column
    ColumnMetadata column = hasAttributeOverride(loggingCtx) ? getAttributeOverride(loggingCtx).getColumn() : getColumn(loggingCtx);
    // Get the actual database field and apply any defaults.
    DatabaseField field = column.getDatabaseField();
    // Make sure there is a table name on the field.
    if (!field.hasTableName()) {
        field.setTable(defaultTable);
    }
    // delimiters.
    if (getProject().useDelimitedIdentifier()) {
        field.getTable().setUseDelimiters(true);
    }
    // Set the correct field name, defaulting and logging when necessary.
    String defaultName = getDefaultAttributeName();
    // If this is for a map key column, append a suffix.
    if (loggingCtx.equals(MetadataLogger.MAP_KEY_COLUMN)) {
        defaultName += DEFAULT_MAP_KEY_COLUMN_SUFFIX;
    }
    setFieldName(field, defaultName, loggingCtx);
    // Store all the fields for this descriptor. This will allow re-use
    // and easy lookup of referenced column names.
    getDescriptor().addField(field);
    return field;
}
Also used : ColumnMetadata(org.eclipse.persistence.internal.jpa.metadata.columns.ColumnMetadata) JoinColumnMetadata(org.eclipse.persistence.internal.jpa.metadata.columns.JoinColumnMetadata) DatabaseField(org.eclipse.persistence.internal.helper.DatabaseField)

Example 3 with ColumnMetadata

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

the class XmlEntityMappingsGenerator method processDirectMapping.

/**
 * Generate a MappingAccessor for a given DirectToFieldMapping.
 */
protected static BasicAccessor processDirectMapping(DirectToFieldMapping mapping) {
    BasicAccessor directMapping;
    if (mapping.getDescriptor().getPrimaryKeyFields().contains(mapping.getField())) {
        directMapping = new IdAccessor();
    } else {
        directMapping = new BasicAccessor();
    }
    directMapping.setName(mapping.getAttributeName());
    directMapping.setAttributeType(mapping.getAttributeClassificationName());
    ColumnMetadata column = new ColumnMetadata();
    column.setName(mapping.getField().getName());
    directMapping.setColumn(column);
    return directMapping;
}
Also used : BasicAccessor(org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.BasicAccessor) ColumnMetadata(org.eclipse.persistence.internal.jpa.metadata.columns.ColumnMetadata) IdAccessor(org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.IdAccessor)

Example 4 with ColumnMetadata

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

the class JPAMetadataGenerator method generateArrayAccessor.

/**
 * Returns an ArrayAccessor instance, constructed based on the given String values.
 */
protected ArrayAccessor generateArrayAccessor(String arrayName, String columnName, String databaseTypeName, String targetClassName) {
    ArrayAccessor array = new ArrayAccessor();
    array.setName(arrayName);
    array.setAttributeType(ARRAYLIST_CLS_STR);
    array.setDatabaseType(databaseTypeName);
    array.setTargetClassName(targetClassName);
    ColumnMetadata column = new ColumnMetadata();
    column.setName(columnName);
    array.setColumn(column);
    return array;
}
Also used : TenantDiscriminatorColumnMetadata(org.eclipse.persistence.internal.jpa.metadata.columns.TenantDiscriminatorColumnMetadata) ColumnMetadata(org.eclipse.persistence.internal.jpa.metadata.columns.ColumnMetadata) ArrayAccessor(org.eclipse.persistence.internal.jpa.metadata.structures.ArrayAccessor)

Example 5 with ColumnMetadata

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

the class JPAMetadataGenerator method generateStructureAccessor.

/**
 * Returns a StructureAccessor instance, constructed based on the given String values.
 */
protected StructureAccessor generateStructureAccessor(String structureName, String columnName, String attributeTypeName, String targetClassName) {
    StructureAccessor structure = new StructureAccessor();
    structure.setName(structureName);
    structure.setAttributeType(attributeTypeName);
    structure.setTargetClassName(targetClassName);
    ColumnMetadata column = new ColumnMetadata();
    column.setName(columnName);
    structure.setColumn(column);
    return structure;
}
Also used : TenantDiscriminatorColumnMetadata(org.eclipse.persistence.internal.jpa.metadata.columns.TenantDiscriminatorColumnMetadata) ColumnMetadata(org.eclipse.persistence.internal.jpa.metadata.columns.ColumnMetadata) StructureAccessor(org.eclipse.persistence.internal.jpa.metadata.structures.StructureAccessor)

Aggregations

ColumnMetadata (org.eclipse.persistence.internal.jpa.metadata.columns.ColumnMetadata)11 TenantDiscriminatorColumnMetadata (org.eclipse.persistence.internal.jpa.metadata.columns.TenantDiscriminatorColumnMetadata)4 BasicAccessor (org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.BasicAccessor)3 ArrayAccessor (org.eclipse.persistence.internal.jpa.metadata.structures.ArrayAccessor)3 IdAccessor (org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.IdAccessor)2 StructureAccessor (org.eclipse.persistence.internal.jpa.metadata.structures.StructureAccessor)2 DatabaseField (org.eclipse.persistence.internal.helper.DatabaseField)1 EntityAccessor (org.eclipse.persistence.internal.jpa.metadata.accessors.classes.EntityAccessor)1 JoinColumnMetadata (org.eclipse.persistence.internal.jpa.metadata.columns.JoinColumnMetadata)1 PLSQLTableMetadata (org.eclipse.persistence.internal.jpa.metadata.queries.PLSQLTableMetadata)1 TableMetadata (org.eclipse.persistence.internal.jpa.metadata.tables.TableMetadata)1 Util.getAttributeTypeNameForFieldType (org.eclipse.persistence.tools.metadata.generation.Util.getAttributeTypeNameForFieldType)1 FieldType (org.eclipse.persistence.tools.oracleddl.metadata.FieldType)1