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");
}
}
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;
}
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;
}
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;
}
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;
}
Aggregations