kodo.jdbc.meta
Class AbstractCollectionFieldMapping
java.lang.Object
|
+--kodo.meta.DelegatingExtensions
|
+--kodo.meta.DelegatingFieldMetaData
|
+--kodo.jdbc.meta.FieldMapping
|
+--kodo.jdbc.meta.ReferenceFieldMapping
|
+--kodo.jdbc.meta.ContainerFieldMapping
|
+--kodo.jdbc.meta.AbstractCollectionFieldMapping
- All Implemented Interfaces:
- Comparable, Extensions, FieldMetaData, JDBCTypes, JDOTypes, Mapping
- Direct Known Subclasses:
- ColumnCollectionFieldMapping, ManyToManyFieldMapping, OneToManyFieldMapping
- public abstract class AbstractCollectionFieldMapping
- extends ContainerFieldMapping
Base class for collection mappings. Manages ordering and basic
query functionality as well as lazy loading. Subclasses must implement
FieldMapping.loadProjection(kodo.jdbc.runtime.JDBCStoreManager, kodo.jdbc.runtime.JDBCFetchConfiguration, kodo.jdbc.sql.Result) even if they have FCO elements.
|
Field Summary |
static String |
ORDERED
Extension key used to mark whether a collection/array mapping should
use an extra column to maintain order. |
| 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 |
|
Method Summary |
protected void |
fromMappingInfo(MappingInfo info,
boolean adapt,
boolean canOrder)
|
Column |
getOrderColumn()
Return the column holding the ordering data. |
int |
getOrdered()
|
protected abstract Result |
getResult(KodoStateManager sm,
JDBCStoreManager store,
JDBCFetchConfiguration fetch)
Implement this method to return a result containing this field. |
void |
load(KodoStateManager sm,
JDBCStoreManager store,
JDBCFetchConfiguration fetch)
Load secondary data using a connection from the store manager. |
protected boolean |
loadBatchedResult(KodoStateManager sm,
JDBCStoreManager store,
JDBCFetchConfiguration fetch,
Result res,
Object key)
Helper method to check the given result for a batched result for this
field, and if present load the field from the batched result. |
protected boolean |
map(Table table,
boolean defaultOrder)
|
void |
refSchemaComponents()
Increment the reference count of all used schema components. |
void |
setOrderColumn(Column col)
Set the column holding the ordering data. |
void |
setOrdered(int ordered)
|
protected Object |
toArray(Collection coll)
Helper method to return the given collection as an array. |
protected Collection |
toCollection(Object array)
Helper method to return the given array as a collection. |
void |
toMappingInfo(MappingInfo info)
Serialize this mapping to a simple MappingInfo instance
for transfer to XML or some other format. |
| Methods inherited from class kodo.jdbc.meta.ContainerFieldMapping |
appendIsEmpty, appendIsNotNull, appendIsNull, containsSelectTables, delete, fromMappingInfo, getContainerMeta, getMetaDataColumn, insert, join, load, map, nullEmbedded, select, setContainerMeta, setMetaDataColumn, supportsTwoPartSelect, update |
| Methods inherited from class kodo.jdbc.meta.ReferenceFieldMapping |
createRefForeignKey, getJoinedRow, getRefForeignKey, getRefJoinType, getSelectJoins, getTable, join, setRefForeignKey, setRefForeignKey, setRefJoinType, wherePrimaryKey, whereRefForeignKey |
| Methods inherited from class kodo.jdbc.meta.FieldMapping |
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, joinKey, joinKeyRelation, joinRelation, loadKeyProjection, loadProjection, newInstance, nullEmbedded, resolve, reverseMap, selectEager, setAutoIncrement, setDeleteAction, setElementDeleteAction, setElementIndexed, setElementSize, setFieldMappingName, setIndexed, setKeyDeleteAction, setKeyIndexed, setKeySize, setOwner, setRefDeleteAction, setRefIndexed, setSize, 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 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 |
ORDERED
public static final String ORDERED
- Extension key used to mark whether a collection/array mapping should
use an extra column to maintain order. The default is true for fields
declared as array or list types, and false otherwise. Note that only
the owner of a field can maintain ordering on it, so inverses in
two-sided relations and 1-many relation't can't be ordered. Legal
values are
true and false.
AbstractCollectionFieldMapping
public AbstractCollectionFieldMapping(FieldMetaData meta)
- Constructor. Supply underlying metadata.
getOrderColumn
public Column getOrderColumn()
- Return the column holding the ordering data.
setOrderColumn
public void setOrderColumn(Column col)
- Set the column holding the ordering data.
getOrdered
public int getOrdered()
setOrdered
public void setOrdered(int ordered)
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.
- Overrides:
toMappingInfo in class ContainerFieldMapping
fromMappingInfo
protected void fromMappingInfo(MappingInfo info,
boolean adapt,
boolean canOrder)
- Overrides:
fromMappingInfo in class ReferenceFieldMapping
map
protected boolean map(Table table,
boolean defaultOrder)
refSchemaComponents
public void refSchemaComponents()
- Description copied from interface:
Mapping
- Increment the reference count of all used schema components.
- Overrides:
refSchemaComponents in class ContainerFieldMapping
load
public void load(KodoStateManager sm,
JDBCStoreManager store,
JDBCFetchConfiguration fetch)
throws SQLException
- Description copied from class:
FieldMapping
- Load secondary data using a connection from the store manager.
- Overrides:
load in class FieldMapping
getResult
protected abstract Result getResult(KodoStateManager sm,
JDBCStoreManager store,
JDBCFetchConfiguration fetch)
throws SQLException
- Implement this method to return a result containing this field.
Elements of the result will be loaded with
FieldMapping.loadProjection(kodo.jdbc.runtime.JDBCStoreManager, kodo.jdbc.runtime.JDBCFetchConfiguration, kodo.jdbc.sql.Result). If this mapping is for large
result sets, pass the fetch configuration on to the store manager when
executing the select for the result. Otherwise, do not pass along
the fetch configuration so a non-lazy result is returned.
loadBatchedResult
protected boolean loadBatchedResult(KodoStateManager sm,
JDBCStoreManager store,
JDBCFetchConfiguration fetch,
Result res,
Object key)
throws SQLException
- Helper method to check the given result for a batched result for this
field, and if present load the field from the batched result. The
first time the batched result is encountered, it will be fully
processed.
- Parameters:
key - the key under which the batched result would be stored- Returns:
- true if a value was loaded, false otherwise
toCollection
protected Collection toCollection(Object array)
- Helper method to return the given array as a collection.
toArray
protected Object toArray(Collection coll)
- Helper method to return the given collection as an array.
Copyright 2001,2002 SolarMetric, Inc. All Rights Reserved.