Top Description Fields Constructors Methods
org.eclipse.persistence.mappings.structures

public Class NestedTableMapping

extends CollectionMapping
Class Inheritance
Imports
java.util.Map, .Vector, org.eclipse.persistence.exceptions.DatabaseException, .DescriptorException, .OptimisticLockException, .QueryException, org.eclipse.persistence.expressions.Expression, .ExpressionBuilder, org.eclipse.persistence.internal.expressions.ObjectExpression, org.eclipse.persistence.internal.helper.DatabaseField, .DatabaseTable, org.eclipse.persistence.internal.queries.ContainerPolicy, org.eclipse.persistence.internal.sessions.AbstractRecord, .AbstractSession, .ChangeRecord, .ObjectChangeSet, .UnitOfWorkChangeSet, .UnitOfWorkImpl, org.eclipse.persistence.mappings.CollectionMapping, .DatabaseMapping, org.eclipse.persistence.queries.DeleteObjectQuery, .InsertObjectQuery, .QueryByExamplePolicy, .WriteObjectQuery

Purpose: Nested tables are similar to VARRAYs except internally they store their information in a separate table from their parent structure's table. The advantage of nested tables is that they support querying and joining much better than varrays that are inlined into the parent table. A nested table is typically used to represent a one-to-many or many-to-many relationship of references to another independent structure. TopLink supports storing a nested table of values into a single field.

Note

Only Oracle8i supports nested tables type.

Since
TOPLink/Java 2.5

Field Summary

Modifier and TypeField and Description
protected DatabaseField
field

A ref is always stored in a single field.

protected DatabaseMapping
protected String
structureName

Arrays require a structure name, this is the ADT defined for the VARRAY.

Inherited from org.eclipse.persistence.mappings.CollectionMapping:
changeOrderTargetQuerycontainerPolicydeleteAllQueryhasCustomDeleteAllQueryhasOrderByisListOrderFieldSupportedisSynchronizeOnMergelistOrderFieldmustDeleteReferenceObjectsOneByOneorderCorrectionType

Constructor Summary

AccessConstructor and Description
public
NestedTableMapping()

PUBLIC: Default constructor.

Method Summary

Modifier and TypeMethod and Description
public Expression
buildExpression(Object
TODO
queryObject
,
QueryByExamplePolicy
TODO
policy
,
Expression
TODO
expressionBuilder
,
Map<K, V>
TODO
processedObjects
,
AbstractSession
TODO
session
)

Overrides org.eclipse.persistence.mappings.CollectionMapping.buildExpression.

INTERNAL: In case Query By Example is used, this method builds and returns an expression that corresponds to a single attribute and it's value.
public Object
clone()

Overrides org.eclipse.persistence.mappings.CollectionMapping.clone.

INTERNAL: The mapping clones itself to create deep copy
protected Vector<E>
public DatabaseField
getField()

Overrides org.eclipse.persistence.mappings.DatabaseMapping.getField.

INTERNAL: Returns the field which this mapping represents.
public String
getFieldName()

PUBLIC: Return the name of the field this mapping represents.

public Expression
getJoinCriteria(ObjectExpression context, Expression base)

Overrides org.eclipse.persistence.mappings.CollectionMapping.getJoinCriteria.

INTERNAL: Join criteria is created to read target records (nested table) from the table.
public String
getStructureName()

PUBLIC: Return the structure name of the nestedTable.

public boolean
hasConstraintDependency()

Overrides org.eclipse.persistence.mappings.DatabaseMapping.hasConstraintDependency.

INTERNAL: The returns if the mapping has any constraint dependencies, such as foreign keys and join tables.
public void
protected void
initializeSelectionCriteria(AbstractSession session)

INTERNAL: Selection criteria is created to read target records (nested table) from the table.

public boolean
public void
public void
preDelete(DeleteObjectQuery query)

Overrides org.eclipse.persistence.mappings.DatabaseMapping.preDelete.

INTERNAL: Delete privately owned parts
public void
preInsert(WriteObjectQuery query)

Overrides org.eclipse.persistence.mappings.CollectionMapping.preInsert.

INTERNAL: Insert privately owned parts
public void
preUpdate(WriteObjectQuery query)

Overrides org.eclipse.persistence.mappings.CollectionMapping.preUpdate.

INTERNAL: Update the privately owned parts
protected void
setField(DatabaseField theField)

Set the field in the mapping.

public void
setFieldName(String FieldName)

PUBLIC: Set the field name in the mapping.

public void
setStructureName(String structureName)

PUBLIC: Set the name of the structure.

protected void
verifyDeleteForUpdate(DeleteObjectQuery query)

INTERNAL: Verifying deletes make sure that all the records privately owned by this mapping are actually removed.

public void
writeFromObjectIntoRow(Object object, AbstractRecord record, AbstractSession session, DatabaseMapping.WriteType writeType)

Overrides org.eclipse.persistence.mappings.DatabaseMapping.writeFromObjectIntoRow.

INTERNAL: Get a value from the object and set that in the respective field of the row.
public void
writeFromObjectIntoRowForShallowInsert(Object object, AbstractRecord record, AbstractSession session)

Overrides org.eclipse.persistence.mappings.DatabaseMapping.writeFromObjectIntoRowForShallowInsert.

INTERNAL: This row is built for shallow insert which happens in case of bidirectional inserts.
public void
writeFromObjectIntoRowForShallowInsertWithChangeRecord(ChangeRecord changeRecord, AbstractRecord record, AbstractSession session)

Overrides org.eclipse.persistence.mappings.DatabaseMapping.writeFromObjectIntoRowForShallowInsertWithChangeRecord.

INTERNAL: This row is built for shallow insert which happens in case of bidirectional inserts.
public void
writeFromObjectIntoRowForUpdate(WriteObjectQuery writeQuery, AbstractRecord record)

Overrides org.eclipse.persistence.mappings.DatabaseMapping.writeFromObjectIntoRowForUpdate.

INTERNAL: Write the entire structure into the row as a special type that prints as the constructor.
public void
writeFromObjectIntoRowForUpdateAfterShallowInsert(Object object, AbstractRecord record, AbstractSession session, DatabaseTable table)

Overrides org.eclipse.persistence.mappings.DatabaseMapping.writeFromObjectIntoRowForUpdateAfterShallowInsert.

INTERNAL: This row is built for update after shallow insert which happens in case of bidirectional inserts.
public void
writeFromObjectIntoRowWithChangeRecord(ChangeRecord changeRecord, AbstractRecord record, AbstractSession session, DatabaseMapping.WriteType writeType)

Overrides org.eclipse.persistence.mappings.DatabaseMapping.writeFromObjectIntoRowWithChangeRecord.

INTERNAL: Get a value from the object and set that in the respective field of the row.
public void
writeInsertFieldsIntoRow(AbstractRecord record, AbstractSession session)

Overrides org.eclipse.persistence.mappings.DatabaseMapping.writeInsertFieldsIntoRow.

INTERNAL: Write fields needed for insert into the template for with null values.
Inherited from org.eclipse.persistence.mappings.CollectionMapping:
addAggregateOrderByaddAscendingOrderingaddDescendingOrderingaddOrderBybuildBackupCloneForPartObjectbuildChangeRecordbuildCloneForPartObjectbuildContainerClonebuildCopybuildElementClonebuildElementUnitOfWorkClonebuildListOrderFieldbuildReferencesPKListcalculateDeferredChangescascadeDiscoverAndPersistUnregisteredNewObjectscascadePerformRemoveIfRequiredcascadePerformRemovePrivateOwnedObjectFromChangeSetIfRequiredcascadeRegisterNewIfRequiredcollectQueryParameterscompareCollectionsForChangecompareForChangecompareListscompareListsAndWritecompareObjectscompareObjectsAndWritecompareObjectsWithoutPrivateOwnedcompareObjectsWithPrivateOwnedconvertClassNamesToClassescopyElementexecuteBatchQueryextractKeyFromTargetRowextractResultFromBatchQueryfixRealObjectReferencesgetAdditionalFieldsBaseExpressiongetContainerPolicygetDeleteAllQuerygetListOrderFieldgetObjectCorrespondingTogetOrderByQueryKeyExpressionsgetOrderCorrectionTypegetRealCollectionAttributeValueFromObjectgetSelectionQueryContainerPolicygetTargetPrimaryKeyFieldshasCustomDeleteAllQueryhasOrderByinitializeChangeOrderTargetQueryinitializeListOrderFieldinitializeListOrderFieldTableisAttributeValueInstantiatedOrChangedisChangeTrackingSupportedisCollectionMappingisListOrderFieldSupportedisMapKeyObjectRelationshipiterateOnElementiterateOnRealAttributeValueloadloadAllmergeChangesIntoObjectmergeIntoObjectmustDeleteReferenceObjectsOneByOneobjectAddedDuringUpdateobjectOrderChangedDuringUpdateobjectRemovedDuringUpdateobjectUnchangedDuringUpdateobjectUnchangedDuringUpdatepostCalculateChangespostDeletepostInsertpostPrepareNestedBatchQueryprepareTranslationRowreadPrivateOwnedForObjectrecordPrivateOwnedRemovalsreplaceValueHoldersInsetChangeListenersetContainerPolicysetCustomDeleteAllQuerysetDeleteAllCallsetDeleteAllQuerysetDeleteAllSQLStringsetHasCustomDeleteAllQuerysetListOrderFieldsetListOrderFieldNamesetMustDeleteReferenceObjectsOneByOnesetOrderCorrectionTypesetSelectionQueryContainerPolicysetSessionNamesetUseLazyInstantiationForIndirectCollectionshouldUseLazyInstantiationForIndirectCollectionshouldUseListOrderFieldTableExpressionsimpleAddToCollectionChangeRecordsimpleRemoveFromCollectionChangeRecordupdateChangeRecordupdateChangeRecordForSelfMergeupdateCollectionChangeRecorduseCollectionClassuseCollectionClassNameuseListClassNameuseMapClassuseMapClassuseMapClassNameuseSortedSetClassuseSortedSetClassNameuseSortedSetClassNameuseTransparentCollectionuseTransparentListuseTransparentMapuseTransparentSetvalidateBeforeInitializationvalueFromPKListvalueFromRowInternalWithJoinverifyDeletewriteChanges

Field Detail

fieldback to summary
protected DatabaseField field

A ref is always stored in a single field.

nestedMappingback to summary
protected DatabaseMapping nestedMapping
structureNameback to summary
protected String structureName

Arrays require a structure name, this is the ADT defined for the VARRAY.

Constructor Detail

NestedTableMappingback to summary
public NestedTableMapping()

PUBLIC: Default constructor.

Method Detail

buildExpressionback to summary
public Expression buildExpression(Object queryObject, QueryByExamplePolicy policy, Expression expressionBuilder, Map<K, V> processedObjects, AbstractSession session)

Overrides org.eclipse.persistence.mappings.CollectionMapping.buildExpression.

INTERNAL: In case Query By Example is used, this method builds and returns an expression that corresponds to a single attribute and it's value.

Parameters
queryObject:Object

Doc from org.eclipse.persistence.mappings.DatabaseMapping.buildExpression.

TODO

policy:QueryByExamplePolicy

Doc from org.eclipse.persistence.mappings.DatabaseMapping.buildExpression.

TODO

expressionBuilder:Expression

Doc from org.eclipse.persistence.mappings.DatabaseMapping.buildExpression.

TODO

processedObjects:Map<K, V>

Doc from org.eclipse.persistence.mappings.DatabaseMapping.buildExpression.

TODO

session:AbstractSession

Doc from org.eclipse.persistence.mappings.DatabaseMapping.buildExpression.

TODO

Returns:Expression

Doc from org.eclipse.persistence.mappings.DatabaseMapping.buildExpression.

TODO

Annotations
@Override
cloneback to summary
public Object clone()

Overrides org.eclipse.persistence.mappings.CollectionMapping.clone.

INTERNAL: The mapping clones itself to create deep copy

Returns:Object

Doc from org.eclipse.persistence.mappings.DatabaseMapping.clone.

new instance of itself

Annotations
@Override
collectFieldsback to summary
protected Vector<E> collectFields()

Overrides org.eclipse.persistence.mappings.DatabaseMapping.collectFields.

Returns all the aggregate fields.

Returns:Vector<E>

Doc from org.eclipse.persistence.mappings.DatabaseMapping.collectFields.

TODO

Annotations
@Override
getFieldback to summary
public DatabaseField getField()

Overrides org.eclipse.persistence.mappings.DatabaseMapping.getField.

INTERNAL: Returns the field which this mapping represents.

Returns:DatabaseField

Doc from org.eclipse.persistence.mappings.DatabaseMapping.getField.

TODO

Annotations
@Override
getFieldNameback to summary
public String getFieldName()

PUBLIC: Return the name of the field this mapping represents.

getJoinCriteriaback to summary
public Expression getJoinCriteria(ObjectExpression context, Expression base)

Overrides org.eclipse.persistence.mappings.CollectionMapping.getJoinCriteria.

INTERNAL: Join criteria is created to read target records (nested table) from the table.

Annotations
@Override
getStructureNameback to summary
public String getStructureName()

PUBLIC: Return the structure name of the nestedTable. This is the name of the user defined data type as defined on the database.

hasConstraintDependencyback to summary
public boolean hasConstraintDependency()

Overrides org.eclipse.persistence.mappings.DatabaseMapping.hasConstraintDependency.

INTERNAL: The returns if the mapping has any constraint dependencies, such as foreign keys and join tables.

Annotations
@Override
initializeback to summary
public void initialize(AbstractSession session) throws DescriptorException

Overrides org.eclipse.persistence.mappings.CollectionMapping.initialize.

INTERNAL: Initialize the mapping.

Annotations
@Override
initializeSelectionCriteriaback to summary
protected void initializeSelectionCriteria(AbstractSession session)

INTERNAL: Selection criteria is created to read target records (nested table) from the table.

isNestedTableMappingback to summary
public boolean isNestedTableMapping()

Overrides org.eclipse.persistence.mappings.DatabaseMapping.isNestedTableMapping.

INTERNAL:

Annotations
@Override
postInitializeback to summary
public void postInitialize(AbstractSession session) throws DescriptorException

Overrides org.eclipse.persistence.mappings.CollectionMapping.postInitialize.

INTERNAL: Post Initialize the mapping.

Annotations
@Override
preDeleteback to summary
public void preDelete(DeleteObjectQuery query) throws DatabaseException, OptimisticLockException

Overrides org.eclipse.persistence.mappings.DatabaseMapping.preDelete.

INTERNAL: Delete privately owned parts

Annotations
@Override
preInsertback to summary
public void preInsert(WriteObjectQuery query) throws DatabaseException, OptimisticLockException

Overrides org.eclipse.persistence.mappings.CollectionMapping.preInsert.

INTERNAL: Insert privately owned parts

Annotations
@Override
preUpdateback to summary
public void preUpdate(WriteObjectQuery query) throws DatabaseException, OptimisticLockException

Overrides org.eclipse.persistence.mappings.CollectionMapping.preUpdate.

INTERNAL: Update the privately owned parts

Annotations
@Override
setFieldback to summary
protected void setField(DatabaseField theField)

Set the field in the mapping.

setFieldNameback to summary
public void setFieldName(String FieldName)

PUBLIC: Set the field name in the mapping.

setStructureNameback to summary
public void setStructureName(String structureName)

PUBLIC: Set the name of the structure. This is the name of the user defined nested table data type as defined on the database.

verifyDeleteForUpdateback to summary
protected void verifyDeleteForUpdate(DeleteObjectQuery query) throws DatabaseException, OptimisticLockException

INTERNAL: Verifying deletes make sure that all the records privately owned by this mapping are actually removed. If such records are found then those are all read and removed one by one taking their privately owned parts into account.

writeFromObjectIntoRowback to summary
public void writeFromObjectIntoRow(Object object, AbstractRecord record, AbstractSession session, DatabaseMapping.WriteType writeType)

Overrides org.eclipse.persistence.mappings.DatabaseMapping.writeFromObjectIntoRow.

INTERNAL: Get a value from the object and set that in the respective field of the row.

Annotations
@Override
writeFromObjectIntoRowForShallowInsertback to summary
public void writeFromObjectIntoRowForShallowInsert(Object object, AbstractRecord record, AbstractSession session)

Overrides org.eclipse.persistence.mappings.DatabaseMapping.writeFromObjectIntoRowForShallowInsert.

INTERNAL: This row is built for shallow insert which happens in case of bidirectional inserts. The foreign keys must be set to null to avoid constraints.

Annotations
@Override
writeFromObjectIntoRowForShallowInsertWithChangeRecordback to summary
public void writeFromObjectIntoRowForShallowInsertWithChangeRecord(ChangeRecord changeRecord, AbstractRecord record, AbstractSession session)

Overrides org.eclipse.persistence.mappings.DatabaseMapping.writeFromObjectIntoRowForShallowInsertWithChangeRecord.

INTERNAL: This row is built for shallow insert which happens in case of bidirectional inserts. The foreign keys must be set to null to avoid constraints.

Annotations
@Override
writeFromObjectIntoRowForUpdateback to summary
public void writeFromObjectIntoRowForUpdate(WriteObjectQuery writeQuery, AbstractRecord record) throws DescriptorException

Overrides org.eclipse.persistence.mappings.DatabaseMapping.writeFromObjectIntoRowForUpdate.

INTERNAL: Write the entire structure into the row as a special type that prints as the constructor. If any part of the structure has changed the whole thing is written.

Annotations
@Override
writeFromObjectIntoRowForUpdateAfterShallowInsertback to summary
public void writeFromObjectIntoRowForUpdateAfterShallowInsert(Object object, AbstractRecord record, AbstractSession session, DatabaseTable table)

Overrides org.eclipse.persistence.mappings.DatabaseMapping.writeFromObjectIntoRowForUpdateAfterShallowInsert.

INTERNAL: This row is built for update after shallow insert which happens in case of bidirectional inserts. It contains the foreign keys with non null values that were set to null for shallow insert.

Annotations
@Override
writeFromObjectIntoRowWithChangeRecordback to summary
public void writeFromObjectIntoRowWithChangeRecord(ChangeRecord changeRecord, AbstractRecord record, AbstractSession session, DatabaseMapping.WriteType writeType)

Overrides org.eclipse.persistence.mappings.DatabaseMapping.writeFromObjectIntoRowWithChangeRecord.

INTERNAL: Get a value from the object and set that in the respective field of the row.

Annotations
@Override
writeInsertFieldsIntoRowback to summary
public void writeInsertFieldsIntoRow(AbstractRecord record, AbstractSession session)

Overrides org.eclipse.persistence.mappings.DatabaseMapping.writeInsertFieldsIntoRow.

INTERNAL: Write fields needed for insert into the template for with null values.

Annotations
@Override