/** * ADVANCED: * Return the class type of the field value. * This can be used if field value differs from the object value, * has specific typing requirements such as usage of java.sql.Blob or NChar. */ public Class getFieldClassification() { if (getField() == null) { return null; } return getField().getType(); }
/** * INTERNAL: * Get all the fields for the map key. */ public List<DatabaseField> getAllFieldsForMapKey(){ Vector<DatabaseField> fields = new Vector<DatabaseField>(1); fields.add(getField()); return fields; }
/** * INTERNAL: * Return the DatabaseField that represents the key in a DirectMapMapping. If the * keyMapping is not a DirectMapping, this will return null. */ @Override public DatabaseField getDirectKeyField(CollectionMapping baseMapping) { if ((keyMapping != null) && ((DatabaseMapping)keyMapping).isDirectToFieldMapping()) { return ((AbstractDirectMapping)keyMapping).getField(); } return null; }
/** * INTERNAL: * Return the DatabaseField that represents the key in a DirectMapMapping. If the * keyMapping is not a DirectMapping, this will return null. */ @Override public DatabaseField getDirectKeyField(CollectionMapping baseMapping) { if ((keyMapping != null) && ((DatabaseMapping)keyMapping).isDirectToFieldMapping()) { return ((AbstractDirectMapping)keyMapping).getField(); } return null; }
/** * INTERNAL: * Return any tables that will be required when this mapping is used as part of a join query. */ public List<DatabaseTable> getAdditionalTablesForJoinQuery() { List tables = new ArrayList(1); tables.add(getField().getTable()); return tables; }
/** * PUBLIC: * Name of the field this mapping represents. */ public String getFieldName() { return getField().getQualifiedName(); }
/** * INTERNAL: */ public String toString() { return getClass().getName() + "[" + getAttributeName() + "-->" + getField() + "]"; }
/** * ADVANCED: * Set the class type of the field value. * This can be used if field value differs from the object value, * has specific typing requirements such as usage of java.sql.Blob or NChar. * This must be called after the field name has been set. */ public void setFieldClassification(Class fieldType) { getField().setType(fieldType); }
/** * ADVANCED: * Set the JDBC type of the field value. * This can be used if field type does not correspond directly to a Java class type, * such as MONEY. * This is used for binding. */ public void setFieldType(int jdbcType) { getField().setSqlType(jdbcType); }
/** * ADVANCED: * Set the JDBC type of the field value. * This can be used if field type does not correspond directly to a Java class type, * such as MONEY. * This is used for binding. */ public void setFieldType(int jdbcType) { getField().setSqlType(jdbcType); }
/** * PUBLIC: * Name of the field this mapping represents. */ public String getFieldName() { return getField().getQualifiedName(); }
/** * ADVANCED: * Set the class type of the field value. * This can be used if field value differs from the object value, * has specific typing requirements such as usage of java.sql.Blob or NChar. * This must be called after the field name has been set. */ public void setFieldClassification(Class fieldType) { getField().setType(fieldType); }
/** * ADVANCED: * Set the class type of the field value. * This can be used if field value differs from the object value, * has specific typing requirements such as usage of java.sql.Blob or NChar. * This must be called after the field name has been set. */ public void setFieldClassification(Class fieldType) { getField().setType(fieldType); }
/** * INTERNAL: * Create a query key that links to the map key. */ public QueryKey createQueryKeyForMapKey() { DirectQueryKey queryKey = new DirectQueryKey(); queryKey.setField(getField()); return queryKey; }
/** * INTERNAL: * The mapping clones itself to create deep copy. */ @Override public Object clone() { AbstractDirectMapping clone = (AbstractDirectMapping)super.clone(); // Field must be cloned so aggregates do not share fields. clone.setField(getField().clone()); return clone; }
/** * INTERNAL: * Write fields needed for insert into the template for with null values. */ @Override public void writeInsertFieldsIntoRow(AbstractRecord databaseRow, AbstractSession session) { if (isInsertable() && ! isReadOnly()) { databaseRow.add(getField(), null); } }
/** * INTERNAL: * Used when initializing queries for mappings that use a Map * Called when the insert query is being initialized to ensure the fields for the map key are in the insert query. */ public void addFieldsForMapKey(AbstractRecord joinRow) { if (!isReadOnly()){ if (isUpdatable()){ joinRow.put(getField(), null); } } }
/** * INTERNAL: * Write fields needed for insert into the template for with null values. */ @Override public void writeInsertFieldsIntoRow(AbstractRecord databaseRow, AbstractSession session) { if (isInsertable() && ! isReadOnly()) { databaseRow.add(getField(), null); } }
/** * INTERNAL: * Write fields needed for update into the template for with null values. * By default inserted fields are used. */ @Override public void writeUpdateFieldsIntoRow(AbstractRecord databaseRow, AbstractSession session) { if (isUpdatable() && ! isReadOnly()) { databaseRow.add(getField(), null); } } }