Overview | Package | Class | Tree | Deprecated | Index | Help
| SolarMetric Kodo JDO 3.0.3 generated on February 20 2004
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## kodo.jdbc.meta
Class ReferenceFieldMapping

    java.lang.Object
      |
      +--kodo.meta.DelegatingExtensions
            |
            +--kodo.meta.DelegatingFieldMetaData
                  |
                  +--kodo.jdbc.meta.FieldMapping
                        |
                        +--kodo.jdbc.meta.ReferenceFieldMapping

All Implemented Interfaces:
  Comparable, Extensions, FieldMetaData, JDBCTypes, JDOTypes, Mapping

Direct Known Subclasses:
  ColumnFieldMapping, ContainerFieldMapping, EmbeddedOneToOneFieldMapping, OneToOneFieldMapping

public abstract class ReferenceFieldMapping
extends FieldMapping

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 class kodo.jdbc.meta.FieldMapping
`AUTO_INCREMENT, DELETE_ACTION, ELEMENT_DELETE_ACTION, ELEMENT_INDEXED, ELEMENT_SIZE, FIELD_MAP, INDEXED, KEY_DELETE_ACTION, KEY_INDEXED, KEY_SIZE, REF_DELETE_ACTION, REF_INDEXED, SIZE, VALUE_DELETE_ACTION, VALUE_INDEXED, VALUE_SIZE`

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.meta.FieldMetaData
`DEPENDENT, ELEMENT_DEPENDENT, ELEMENT_TYPE, EXTERNALIZER, FACTORY, FETCH_GROUP, INVERSE_OWNER, KEY_DEPENDENT, KEY_TYPE, LRS, MANAGE_NONE, MANAGE_PERSISTENT, MANAGE_TRANSACTIONAL, NULL_DEFAULT, NULL_EXCEPTION, NULL_NONE, TYPE, VALUE_DEPENDENT, VALUE_TYPE`

Constructor Summary
`ReferenceFieldMapping(FieldMetaData meta)` Constructor.

Method Summary
`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.
`int` | `getRefJoinType()` Return the reference join type.
`protected Joins` | `getSelectJoins(Select sel)` Return any joins needed to get from the primary table to this table for a select.
`Table` | `getTable()` Return the mapping's primary data table.
`protected void` | `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.FieldMapping
`appendIsEmpty, appendIsNotNull, appendIsNull, containsSelectTables, delete, deleteEmbedded, deleteEmbedded, getColumns, getDataStoreValue, getDBDictionary, getDeclaredElementTypeMapping, getDeclaredElementTypeMetaData, getDeclaredKeyTypeMapping, getDeclaredKeyTypeMetaData, getDeclaredTypeMapping, getDeclaredTypeMetaData, getDefaults, getDeleteAction, getElementDeleteAction, getElementIndexed, getElementSize, getElementTypeMapping, getElementTypeMetaData, getFieldMappingName, getIndexed, getInverseOwnerMapping, getInverseOwnerMetaData, getKeyColumns, getKeyDataStoreValue, getKeyDeleteAction, getKeyIndexed, getKeySize, getKeyTypeMapping, getKeyTypeMetaData, getMappingRepository, getOwner, getOwnerMapping, getRefDeleteAction, getRefIndexed, getSize, getTypeMapping, getTypeMetaData, insert, invalidateResolve, isAutoIncrement, isCustomDelete, isCustomDeleteEmbedded, isCustomInsert, isCustomNullEmbedded, isCustomUpdate, isDeleteActionDeferred, isElementDeleteActionDeferred, isKeyDeleteActionDeferred, isRefDeleteActionDeferred, isResolved, join, joinKey, joinKeyRelation, joinRelation, load, load, loadKeyProjection, loadProjection, newInstance, nullEmbedded, nullEmbedded, resolve, reverseMap, select, selectEager, setAutoIncrement, setDeleteAction, setElementDeleteAction, setElementIndexed, setElementSize, setFieldMappingName, setIndexed, setKeyDeleteAction, setKeyIndexed, setKeySize, setOwner, setRefDeleteAction, setRefIndexed, setSize, supportsTwoPartSelect, update`

Methods inherited from class kodo.meta.DelegatingFieldMetaData
`compareTo, equals, getComparator, getDeclaredElementType, getDeclaredElementTypeCode, getDeclaredIndex, getDeclaredKeyType, getDeclaredKeyTypeCode, getDeclaredType, getDeclaredTypeCode, getDelegate, getElementType, getElementTypeCode, getElementTypeName, getExternalizer, getExternalizerMethod, getExternalValue, getFactory, getFactoryMethod, getFetchGroup, getFieldFlag, getFieldValue, getFullName, getIndex, getInnermostDelegate, getInverseOwner, getKeyType, getKeyTypeCode, getKeyTypeName, getManagement, getName, getNullValue, getPrimaryKeyIndex, getProxyType, getType, getTypeCode, getTypeName, hashCode, isDefaultFetchGroupExplicit, isDependent, isElementDependent, isElementEmbedded, isEmbedded, isExplicit, isInDefaultFetchGroup, isKeyDependent, isKeyEmbedded, isLRS, isPrimaryKey, isTransient, setComparator, setDeclaredElementType, setDeclaredElementTypeCode, setDeclaredIndex, setDeclaredKeyType, setDeclaredKeyTypeCode, setDeclaredType, setDeclaredTypeCode, setDependent, setElementDependent, setElementEmbedded, setElementTypeName, setEmbedded, setExplicit, setExternalizer, setFactory, setFetchGroup, setInDefaultFetchGroup, setIndex, setInverseOwner, setKeyDependent, setKeyEmbedded, setKeyTypeName, setLRS, setManagement, setName, setNullValue, setPrimaryKey, setPrimaryKeyIndex, setProxyType, setTransient, setTypeName, toString`

Methods inherited from class kodo.meta.DelegatingExtensions
`addExtension, addExtension, getBooleanExtension, getBooleanExtension, getDoubleExtension, getDoubleExtension, getEmbeddedExtensions, getEmbeddedExtensions, 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
`fromMappingInfo, getMappingType, insert, map, update`

Methods inherited from interface kodo.meta.Extensions
`addExtension, addExtension, getBooleanExtension, getBooleanExtension, getDoubleExtension, getDoubleExtension, getEmbeddedExtensions, getEmbeddedExtensions, getExtensionKeys, getExtensionKeys, getExtensionVendors, getIntExtension, getIntExtension, getObjectExtension, getObjectExtension, getStringExtension, getStringExtension, hasExtension, hasExtension, isEmpty, removeEmbeddedExtensions, removeEmbeddedExtensions, removeExtension, removeExtension`

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)

### 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 void join(Joins joins,
                        boolean toMany)

  Joins from the owning class' table to the table where this field lies using the reference foreign key.

### getSelectJoins

    protected Joins getSelectJoins(Select sel)

  Return any joins needed to get from the primary table to this table for a select.

### 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)`

Overview | Package | Class | Tree | Deprecated | Index | Help
| SolarMetric Kodo JDO 3.0.3 generated on February 20 2004
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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