SolarMetric Kodo JDO 3.3.5 generated on August 31 2005

kodo.jdbc.meta
Class ReferenceFieldMapping

java.lang.Object
  |
  +--kodo.meta.DelegatingExtensions
        |
        +--kodo.meta.DelegatingFieldMetaData
              |
              +--kodo.jdbc.meta.AbstractFieldMapping
                    |
                    +--kodo.jdbc.meta.ReferenceFieldMapping
All Implemented Interfaces:
Commentable, Comparable, Extensions, FieldMapping, FieldMetaData, JDBCTypes, JDOTypes, Mapping
Direct Known Subclasses:
ColumnFieldMapping, ContainerFieldMapping, EmbeddedOneToOneFieldMapping, OneToOneFieldMapping

public abstract class ReferenceFieldMapping
extends AbstractFieldMapping

Base class of most field mappings. Maps a value that might be in a table other than the owning class' table, and manages the reference foreign key linking to the parent table (if such a key exists).


Fields inherited from interface kodo.jdbc.meta.JDBCTypes
TYPE_ASCII_STREAM, TYPE_BINARY_STREAM, TYPE_BLOB, TYPE_BYTES, TYPE_CHAR_STREAM, TYPE_CLOB, TYPE_JDBC_DEFAULT, TYPE_REF, TYPE_SQL_ARRAY, TYPE_SQL_DATE, TYPE_SQL_OBJECT, TYPE_TIME, TYPE_TIMESTAMP
 
Fields inherited from interface kodo.meta.JDOTypes
TYPE_ARRAY, TYPE_BIGDECIMAL, TYPE_BIGINTEGER, TYPE_BOOLEAN, TYPE_BOOLEAN_OBJ, TYPE_BYTE, TYPE_BYTE_OBJ, TYPE_CHAR, TYPE_CHAR_OBJ, TYPE_COLLECTION, TYPE_DATE, TYPE_DOUBLE, TYPE_DOUBLE_OBJ, TYPE_FCO, TYPE_FLOAT, TYPE_FLOAT_OBJ, TYPE_INT, TYPE_INT_OBJ, TYPE_LOCALE, TYPE_LONG, TYPE_LONG_OBJ, TYPE_MAP, TYPE_NUMBER, TYPE_OBJECT, TYPE_PC_OBJECT, TYPE_SHORT, TYPE_SHORT_OBJ, TYPE_STRING
 
Fields inherited from interface kodo.jdbc.meta.FieldMapping
AUTO_INCREMENT, DELETE_ACTION, ELEMENT_DELETE_ACTION, ELEMENT_INDEXED, ELEMENT_SIZE, EXTENSION_KEYS, FIELD_MAP, INDEXED, JDBC_TYPE, KEY_DELETE_ACTION, KEY_INDEXED, KEY_SIZE, REF_DELETE_ACTION, REF_INDEXED, SIZE, SQL_TYPE, VALUE_DELETE_ACTION, VALUE_INDEXED, VALUE_SIZE
 
Fields inherited from interface kodo.meta.FieldMetaData
DEPENDENT, EAGER_FETCH_MODE, ELEMENT_DEPENDENT, ELEMENT_TYPE, EXTERNAL_VALUES, EXTERNALIZER, FACTORY, FETCH_GROUP, INVERSE_LOGICAL, INVERSE_OWNER, KEY_DEPENDENT, KEY_TYPE, LOCK_GROUP, LOCK_GROUP_DEFAULT, LOCK_GROUP_NONE, LRS, MANAGE_NONE, MANAGE_PERSISTENT, MANAGE_TRANSACTIONAL, NULL_DEFAULT, NULL_EXCEPTION, NULL_NONE, NULL_UNSET, SEQUENCE_ASSIGNED, TYPE, VALUE_DEPENDENT, VALUE_TYPE
 
Constructor Summary
ReferenceFieldMapping(FieldMetaData meta)
          Constructor.
 
Method Summary
 void addMappingInfoAttributes(Collection attrs)
          Add all mapping attributes names used by this mapping to the given collection.
protected  void createRefForeignKey(Table table)
          Creates the reference foreign key on the given secondary table.
 void delete(KodoStateManager sm, RowManager rm)
          Delete the row for this object if the reference foreign key exists.
protected  void fromMappingInfo(MappingInfo info, boolean adapt, boolean fkRequired)
           
protected  Row getJoinedRow(RowManager rm, int action, KodoStateManager sm, boolean nullEmbedded)
          Return the row to use for this field.
 ForeignKey getRefForeignKey()
          Return the foreign key linking this mapping to the parent table.
protected  Joins getRefJoins(Select sel)
          Return any joins needed to get from the primary table to this table.
 int getRefJoinType()
          Return the reference join type.
 Table getTable()
          Return the mapping's primary data table.
protected  Joins join(Joins joins, boolean toMany)
          Joins from the owning class' table to the table where this field lies using the reference foreign key.
 void refSchemaComponents()
          Increment the reference count of all used schema components.
 void setRefForeignKey(ForeignKey fk)
          Set the foreign key linking this mapping to the parent table.
protected  void setRefForeignKey(KodoStateManager sm, Row row)
          Set the reference foreign key if it exists.
 void setRefJoinType(int joinType)
          Set the reference join type.
 void toMappingInfo(MappingInfo info)
          Serialize this mapping to a simple MappingInfo instance for transfer to XML or some other format.
protected  void wherePrimaryKey(Select sel, KodoStateManager sm)
          Add a wherePrimaryKey or whereForeignKey condition to the given select, depending on whether we have a reference foreign key.
protected  void whereRefForeignKey(KodoStateManager sm, Row row)
          Add a WHERE condition matching the reference foreign key to the given value on the given row.
 
Methods inherited from class kodo.jdbc.meta.AbstractFieldMapping
addExtensionKeys, appendIsEmpty, assertTable, delete, deleteEmbedded, deleteEmbedded, fromMappingInfo, getDataStoreValue, getDBDictionary, getDeclaredElementTypeMapping, getDeclaredElementTypeMetaData, getDeclaredKeyTypeMapping, getDeclaredKeyTypeMetaData, getDeclaredTypeMapping, getDeclaredTypeMetaData, getDeleteAction, getElementDeleteAction, getElementIndexed, getElementSize, getElementTypeMapping, getElementTypeMetaData, getFieldMappingName, getIndexed, getInverseMappings, getInverseMetaDatas, getInverseOwnerMapping, getInverseOwnerMetaData, getJDBCTypeCode, getKeyColumns, getKeyDataStoreValue, getKeyDeleteAction, getKeyIndexed, getKeySize, getKeyTypeMapping, getKeyTypeMetaData, getMappingRepository, getMetaData, getNonVirtualOwner, getOwner, getOwnerMapping, getOwnerTable, getRefDeleteAction, getRefIndexed, getSize, getSQLType, getTypeMapping, getTypeMetaData, insert, invalidateResolve, isAutoIncrement, isCustomDelete, isCustomDeleteEmbedded, isCustomInsert, isCustomNullEmbedded, isCustomUpdate, isDeleteActionDeferred, isEagerJoinToMany, isElementDeleteActionDeferred, isKeyDeleteActionDeferred, isPCObjectRelation, isRefDeleteActionDeferred, isResolved, join, joinKey, joinKeyRelation, joinRelation, loadEagerJoin, loadEagerParallel, loadKeyProjection, nullEmbedded, nullEmbedded, resolve, reverseMap, selectEagerJoin, selectEagerParallel, setAutoIncrement, setDeleteAction, setElementDeleteAction, setElementIndexed, setElementSize, setFieldMappingName, setIndexed, setJDBCTypeCode, setKeyDeleteAction, setKeyIndexed, setKeySize, setNonVirtualOwner, setOwner, setRefDeleteAction, setRefIndexed, setSize, setSQLType, supportsSelect, update, usesImplData, usesIntermediate
 
Methods inherited from class kodo.meta.DelegatingFieldMetaData
compareTo, equals, getComments, getComparator, getDeclaredElementType, getDeclaredElementTypeCode, getDeclaredIndex, getDeclaredKeyType, getDeclaredKeyTypeCode, getDeclaredPrimaryKeyIndex, getDeclaredType, getDeclaredTypeCode, getDelegate, getEagerFetchMode, getElementType, getElementTypeCode, getElementTypeName, getExternalizer, getExternalValue, getExternalValues, getFactory, getFetchGroup, getFieldFlag, getFieldValue, getFullName, getIndex, getInnermostDelegate, getInverseLogical, getInverseOwner, getKeyType, getKeyTypeCode, getKeyTypeName, getListingIndex, getLockGroup, getManagement, getName, getNullValue, getPrimaryKeyIndex, getProxyType, getType, getTypeCode, getTypeName, hashCode, isDefaultFetchGroupExplicit, isDependent, isElementDependent, isElementEmbedded, isEmbedded, isExplicit, isExternalized, isInDefaultFetchGroup, isKeyDependent, isKeyEmbedded, isLRS, isPrimaryKey, isSequenceAssigned, isTransient, setComparator, setDeclaredElementType, setDeclaredElementTypeCode, setDeclaredIndex, setDeclaredKeyType, setDeclaredKeyTypeCode, setDeclaredPrimaryKeyIndex, setDeclaredType, setDeclaredTypeCode, setDependent, setEagerFetchMode, setElementDependent, setElementEmbedded, setElementTypeName, setEmbedded, setExplicit, setExternalizer, setExternalValues, setFactory, setFetchGroup, setInDefaultFetchGroup, setIndex, setInverseLogical, setInverseOwner, setKeyDependent, setKeyEmbedded, setKeyTypeName, setListingIndex, setLockGroup, setLRS, setManagement, setName, setNullValue, setPrimaryKey, setProxyType, setSequenceAssigned, setTransient, setTypeName, toString
 
Methods inherited from class kodo.meta.DelegatingExtensions
addExtension, addExtension, getBooleanExtension, getBooleanExtension, getDoubleExtension, getDoubleExtension, getEmbeddedExtensions, getEmbeddedExtensions, getExtensionComments, getExtensionKeys, getExtensionKeys, getExtensionVendors, getIntExtension, getIntExtension, getObjectExtension, getObjectExtension, getStringExtension, getStringExtension, hasExtension, hasExtension, isEmpty, removeEmbeddedExtensions, removeEmbeddedExtensions, removeExtension, removeExtension
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface kodo.jdbc.meta.Mapping
getMappingType, insert, map, update
 
Methods inherited from interface kodo.jdbc.meta.FieldMapping
appendIsNotNull, appendIsNull, getColumns, load, load, loadProjection, select
 
Methods inherited from interface kodo.meta.FieldMetaData
getComparator, getDeclaredElementType, getDeclaredElementTypeCode, getDeclaredIndex, getDeclaredKeyType, getDeclaredKeyTypeCode, getDeclaredPrimaryKeyIndex, getDeclaredType, getDeclaredTypeCode, getEagerFetchMode, getElementType, getElementTypeCode, getElementTypeName, getExternalizer, getExternalValue, getExternalValues, getFactory, getFetchGroup, getFieldFlag, getFieldValue, getFullName, getIndex, getInverseLogical, getInverseOwner, getKeyType, getKeyTypeCode, getKeyTypeName, getListingIndex, getLockGroup, getManagement, getName, getNullValue, getPrimaryKeyIndex, getProxyType, getType, getTypeCode, getTypeName, isDefaultFetchGroupExplicit, isDependent, isElementDependent, isElementEmbedded, isEmbedded, isExplicit, isExternalized, isInDefaultFetchGroup, isKeyDependent, isKeyEmbedded, isLRS, isPrimaryKey, isSequenceAssigned, isTransient, setComparator, setDeclaredElementType, setDeclaredElementTypeCode, setDeclaredIndex, setDeclaredKeyType, setDeclaredKeyTypeCode, setDeclaredPrimaryKeyIndex, setDeclaredType, setDeclaredTypeCode, setDependent, setEagerFetchMode, setElementDependent, setElementEmbedded, setElementTypeName, setEmbedded, setExplicit, setExternalizer, setExternalValues, setFactory, setFetchGroup, setInDefaultFetchGroup, setIndex, setInverseLogical, setInverseOwner, setKeyDependent, setKeyEmbedded, setKeyTypeName, setListingIndex, setLockGroup, setLRS, setManagement, setName, setNullValue, setPrimaryKey, setProxyType, setSequenceAssigned, setTransient, setTypeName
 
Methods inherited from interface kodo.meta.Extensions
addExtension, addExtension, getBooleanExtension, getBooleanExtension, getDoubleExtension, getDoubleExtension, getEmbeddedExtensions, getEmbeddedExtensions, getExtensionComments, getExtensionKeys, getExtensionKeys, getExtensionVendors, getIntExtension, getIntExtension, getObjectExtension, getObjectExtension, getStringExtension, getStringExtension, hasExtension, hasExtension, isEmpty, removeEmbeddedExtensions, removeEmbeddedExtensions, removeExtension, removeExtension
 
Methods inherited from interface java.lang.Comparable
compareTo
 
Methods inherited from interface kodo.meta.Commentable
getComments
 

Constructor Detail

ReferenceFieldMapping

public ReferenceFieldMapping(FieldMetaData meta)
Constructor. Supply underlying metadata.
Method Detail

getRefForeignKey

public ForeignKey getRefForeignKey()
Return the foreign key linking this mapping to the parent table.

setRefForeignKey

public void setRefForeignKey(ForeignKey fk)
Set the foreign key linking this mapping to the parent table.

getRefJoinType

public int getRefJoinType()
Return the reference join type.

setRefJoinType

public void setRefJoinType(int joinType)
Set the reference join type.

getTable

public Table getTable()
Description copied from interface: Mapping
Return the mapping's primary data table.

toMappingInfo

public void toMappingInfo(MappingInfo info)
Description copied from interface: Mapping
Serialize this mapping to a simple MappingInfo instance for transfer to XML or some other format.

fromMappingInfo

protected void fromMappingInfo(MappingInfo info,
                               boolean adapt,
                               boolean fkRequired)

addMappingInfoAttributes

public void addMappingInfoAttributes(Collection attrs)
Description copied from interface: Mapping
Add all mapping attributes names used by this mapping to the given collection. For foreign key attributes, add the prefix.
Overrides:
addMappingInfoAttributes in class AbstractFieldMapping

refSchemaComponents

public void refSchemaComponents()
Description copied from interface: Mapping
Increment the reference count of all used schema components.

createRefForeignKey

protected void createRefForeignKey(Table table)
Creates the reference foreign key on the given secondary table.

join

protected Joins join(Joins joins,
                     boolean toMany)
Joins from the owning class' table to the table where this field lies using the reference foreign key.

getRefJoins

protected Joins getRefJoins(Select sel)
Return any joins needed to get from the primary table to this table.

wherePrimaryKey

protected void wherePrimaryKey(Select sel,
                               KodoStateManager sm)
Add a wherePrimaryKey or whereForeignKey condition to the given select, depending on whether we have a reference foreign key.

getJoinedRow

protected Row getJoinedRow(RowManager rm,
                           int action,
                           KodoStateManager sm,
                           boolean nullEmbedded)
                    throws SQLException
Return the row to use for this field. This method is meant only for single-value fields that might reside in a table that is joined to the primary table through the reference foreign key. It is not meant for multi-valued fields like collections and maps. The method checks whether the join type of the field is Join.TYPE_OUTER, and if so it deletes the field's previous value, then if the field is non-null returns an insert row for the new value. The reference foreign key will already be set on the returned row; subclass mappings just need to set their own values.
Parameters:
nullEmbedded - true if the row is being used to null an embedded value

setRefForeignKey

protected void setRefForeignKey(KodoStateManager sm,
                                Row row)
                         throws SQLException
Set the reference foreign key if it exists.

whereRefForeignKey

protected void whereRefForeignKey(KodoStateManager sm,
                                  Row row)
                           throws SQLException
Add a WHERE condition matching the reference foreign key to the given value on the given row.

delete

public void delete(KodoStateManager sm,
                   RowManager rm)
            throws SQLException
Delete the row for this object if the reference foreign key exists.
Following copied from interface: kodo.jdbc.meta.Mapping
See Also:
Mapping.insert(kodo.runtime.KodoStateManager, kodo.jdbc.sql.RowManager)

SolarMetric Kodo JDO 3.3.5 generated on August 31 2005

Copyright 2001,2002 SolarMetric, Inc. All Rights Reserved.