use of org.eclipse.persistence.mappings.structures.ObjectRelationalDatabaseField in project eclipselink by eclipse-ee4j.
the class StoredProcedureParameterMetadata method buildNestedField.
/**
* Builds an ObjectRelationalDatabaseField based on a given OracleArrayTypeMetadata
* instance.
*
* @param aType OracleArrayTypeMetadata instance to be used to construct the field
* @return an ObjectRelationalDatabaseField instance
*/
protected ObjectRelationalDatabaseField buildNestedField(OracleArrayTypeMetadata aType) {
ObjectRelationalDatabaseField dbFld = new ObjectRelationalDatabaseField("");
String nestedType = aType.getNestedType();
dbFld.setSqlTypeName(nestedType);
for (OracleObjectTypeMetadata oType : getEntityMappings().getOracleObjectTypes()) {
if (oType.getName().equals(nestedType)) {
dbFld.setSqlType(STRUCT);
dbFld.setTypeName(oType.getJavaType());
}
}
return dbFld;
}
use of org.eclipse.persistence.mappings.structures.ObjectRelationalDatabaseField in project eclipselink by eclipse-ee4j.
the class ArrayAccessor method process.
/**
* INTERNAL:
* Process the ArrayMapping or ObjectArrayMapping.
*/
@Override
public void process() {
if (isDirectEmbeddableCollection()) {
ObjectArrayMapping mapping = new ObjectArrayMapping();
// Add the mapping to the descriptor.
setMapping(mapping);
// Set the reference class name.
mapping.setReferenceClassName(getReferenceClassName());
// Set the attribute name.
mapping.setAttributeName(getAttributeName());
// Will check for PROPERTY access
setAccessorMethods(mapping);
mapping.setStructureName(getDatabaseType());
// Process the @Column or column element if there is one.
// A number of methods depend on this field so it must be
// initialized before any further processing can take place.
mapping.setField(new ObjectRelationalDatabaseField(getDatabaseField(getDescriptor().getPrimaryTable(), MetadataLogger.COLUMN)));
} else {
ArrayMapping mapping = new ArrayMapping();
// Add the mapping to the descriptor.
setMapping(mapping);
// Set the attribute name.
mapping.setAttributeName(getAttributeName());
// Will check for PROPERTY access
setAccessorMethods(mapping);
mapping.setStructureName(getDatabaseType());
// Process the @Column or column element if there is one.
// A number of methods depend on this field so it must be
// initialized before any further processing can take place.
mapping.setField(new ObjectRelationalDatabaseField(getDatabaseField(getDescriptor().getPrimaryTable(), MetadataLogger.COLUMN)));
}
}
use of org.eclipse.persistence.mappings.structures.ObjectRelationalDatabaseField in project eclipselink by eclipse-ee4j.
the class StructureAccessor method process.
/**
* INTERNAL:
* Build and structure mapping and add it to the descriptor.
*/
@Override
public void process() {
StructureMapping mapping = new StructureMapping();
setMapping(mapping);
// Process the @Column or column element if there is one.
// A number of methods depend on this field so it must be
// initialized before any further processing can take place.
m_field = new ObjectRelationalDatabaseField(getDatabaseField(getDescriptor().getPrimaryTable(), MetadataLogger.COLUMN));
mapping.setField(m_field);
mapping.setIsReadOnly(m_field.isReadOnly());
mapping.setReferenceClassName(getReferenceClassName());
mapping.setAttributeName(getAttributeName());
// Will check for PROPERTY access
setAccessorMethods(mapping);
// Process a @ReturnInsert and @ReturnUpdate (to log a warning message)
processReturnInsertAndUpdate();
}
use of org.eclipse.persistence.mappings.structures.ObjectRelationalDatabaseField in project eclipselink by eclipse-ee4j.
the class DatabasePlatform method setNullFromDatabaseField.
protected void setNullFromDatabaseField(DatabaseField databaseField, CallableStatement statement, String name) throws SQLException {
// user defined type to setNull as well.
if (databaseField instanceof ObjectRelationalDatabaseField) {
ObjectRelationalDatabaseField field = (ObjectRelationalDatabaseField) databaseField;
statement.setNull(name, field.getSqlType(), field.getSqlTypeName());
} else {
int jdbcType = getJDBCTypeForSetNull(databaseField);
statement.setNull(name, jdbcType);
}
}
use of org.eclipse.persistence.mappings.structures.ObjectRelationalDatabaseField in project eclipselink by eclipse-ee4j.
the class DatabasePlatform method setNullFromDatabaseField.
protected void setNullFromDatabaseField(DatabaseField databaseField, PreparedStatement statement, int index) throws SQLException {
// user defined type to setNull as well.
if (databaseField instanceof ObjectRelationalDatabaseField) {
ObjectRelationalDatabaseField field = (ObjectRelationalDatabaseField) databaseField;
statement.setNull(index, field.getSqlType(), field.getSqlTypeName());
} else {
int jdbcType = getJDBCTypeForSetNull(databaseField);
statement.setNull(index, jdbcType);
}
}
Aggregations