Search in sources :

Example 6 with ArrayAccessor

use of org.eclipse.persistence.internal.jpa.metadata.structures.ArrayAccessor in project eclipselink by eclipse-ee4j.

the class JPAMetadataGenerator method generateEmbeddable.

/**
 * Generate an Embeddable for the given OracleArrayTypeMetadata, and add
 * it to the list of Embeddables on the XMLEntityMappings instance.
 */
protected void generateEmbeddable(OracleArrayTypeMetadata arrayTypeMetadata, CompositeDatabaseTypeWithEnclosedType dbType) {
    // avoid double-processing
    if (!embeddableAlreadyProcessed(arrayTypeMetadata.getJavaType())) {
        EmbeddableAccessor embeddable = initEmbeddable(arrayTypeMetadata.getJavaType());
        ArrayAccessor array;
        if (dbType.getEnclosedType().isComposite()) {
            array = generateArrayAccessor(ITEMS_FLD_STR, ITEMS_COL_STR, arrayTypeMetadata.getNestedType(), getGeneratedJavaClassName(arrayTypeMetadata.getNestedType(), defaultPackage));
        } else {
            array = generateArrayAccessor(ITEMS_FLD_STR, ITEMS_COL_STR, dbType.getEnclosedType().getTypeName());
        }
        embeddable.getAttributes().getArrays().add(array);
        // set on the XMLEntityMappings instance
        xmlEntityMappings.getEmbeddables().add(embeddable);
        // track to avoid double processing
        getGeneratedEmbeddables().add(arrayTypeMetadata.getJavaType());
    }
}
Also used : EmbeddableAccessor(org.eclipse.persistence.internal.jpa.metadata.accessors.classes.EmbeddableAccessor) ArrayAccessor(org.eclipse.persistence.internal.jpa.metadata.structures.ArrayAccessor)

Example 7 with ArrayAccessor

use of org.eclipse.persistence.internal.jpa.metadata.structures.ArrayAccessor in project eclipselink by eclipse-ee4j.

the class XmlEntityMappingsGenerator method processArrayMapping.

/**
 * Generate a MappingAccessor for a given ArrayMapping.
 */
protected static ArrayAccessor processArrayMapping(ArrayMapping mapping) {
    ArrayAccessor arrayAccessor = new ArrayAccessor();
    arrayAccessor.setName(mapping.getAttributeName());
    arrayAccessor.setDatabaseType(mapping.getStructureName());
    arrayAccessor.setAttributeType(ARRAYLIST_STR);
    arrayAccessor.setTargetClassName(mapping.getStructureName());
    ColumnMetadata column = new ColumnMetadata();
    column.setName(mapping.getField().getName());
    arrayAccessor.setColumn(column);
    return arrayAccessor;
}
Also used : ColumnMetadata(org.eclipse.persistence.internal.jpa.metadata.columns.ColumnMetadata) ArrayAccessor(org.eclipse.persistence.internal.jpa.metadata.structures.ArrayAccessor)

Example 8 with ArrayAccessor

use of org.eclipse.persistence.internal.jpa.metadata.structures.ArrayAccessor in project eclipselink by eclipse-ee4j.

the class XmlEntityMappingsGenerator method processObjectArrayMapping.

/**
 * Generate a MappingAccessor for a given ObjectArrayMapping.
 */
protected static ArrayAccessor processObjectArrayMapping(ObjectArrayMapping mapping) {
    ArrayAccessor arrayAccessor = new ArrayAccessor();
    arrayAccessor.setName(mapping.getAttributeName());
    arrayAccessor.setDatabaseType(mapping.getStructureName());
    arrayAccessor.setTargetClassName(mapping.getReferenceClassName());
    arrayAccessor.setAttributeType(ARRAYLIST_STR);
    ColumnMetadata column = new ColumnMetadata();
    column.setName(mapping.getField().getName());
    arrayAccessor.setColumn(column);
    return arrayAccessor;
}
Also used : ColumnMetadata(org.eclipse.persistence.internal.jpa.metadata.columns.ColumnMetadata) ArrayAccessor(org.eclipse.persistence.internal.jpa.metadata.structures.ArrayAccessor)

Aggregations

ArrayAccessor (org.eclipse.persistence.internal.jpa.metadata.structures.ArrayAccessor)8 EmbeddableAccessor (org.eclipse.persistence.internal.jpa.metadata.accessors.classes.EmbeddableAccessor)3 BasicAccessor (org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.BasicAccessor)3 EmbeddedAccessor (org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.EmbeddedAccessor)3 ColumnMetadata (org.eclipse.persistence.internal.jpa.metadata.columns.ColumnMetadata)3 StructureAccessor (org.eclipse.persistence.internal.jpa.metadata.structures.StructureAccessor)3 XMLAttributes (org.eclipse.persistence.internal.jpa.metadata.accessors.classes.XMLAttributes)2 IdAccessor (org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.IdAccessor)2 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1 ClassDescriptor (org.eclipse.persistence.descriptors.ClassDescriptor)1 DatabaseField (org.eclipse.persistence.internal.helper.DatabaseField)1 ClassAccessor (org.eclipse.persistence.internal.jpa.metadata.accessors.classes.ClassAccessor)1 EntityAccessor (org.eclipse.persistence.internal.jpa.metadata.accessors.classes.EntityAccessor)1 BasicCollectionAccessor (org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.BasicCollectionAccessor)1 BasicMapAccessor (org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.BasicMapAccessor)1 ElementCollectionAccessor (org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.ElementCollectionAccessor)1 ManyToManyAccessor (org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.ManyToManyAccessor)1 ManyToOneAccessor (org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.ManyToOneAccessor)1