Module org.eclipse.persistence.core
Package org.eclipse.persistence.mappings
Class DirectCollectionMapping
java.lang.Object
org.eclipse.persistence.core.mappings.CoreMapping<AttributeAccessor,AbstractSession,ContainerPolicy,ClassDescriptor,DatabaseField>
org.eclipse.persistence.mappings.DatabaseMapping
org.eclipse.persistence.mappings.ForeignReferenceMapping
org.eclipse.persistence.mappings.CollectionMapping
org.eclipse.persistence.mappings.DirectCollectionMapping
- All Implemented Interfaces:
Serializable
,Cloneable
,ContainerMapping
,RelationalMapping
- Direct Known Subclasses:
DirectMapMapping
Purpose: This mapping is used to store a collection of simple types (String, Number, Date, etc.) into a single table. The table must store the value and a foreign key to the source object. A converter can be used if the desired object type and the data type do not match.
- Since:
- TOPLink/Java 1.0 09/18/2009-2.0 Michael O'Brien - 266912: JPA 2.0 Metamodel API (part of the JSR-317 EJB 3.1 Criteria API) add support for passing BasicMap value type to MapAttributeImpl via new attributeClassification field
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.eclipse.persistence.mappings.DatabaseMapping
DatabaseMapping.WriteType
-
Field Summary
Modifier and TypeFieldDescriptionprotected Class
<?> protected String
protected ModifyQuery
protected ModifyQuery
Used for deletion when ChangeSets are usedprotected static final String
Used for data modification events.protected static final String
protected static final String
protected ModifyQuery
Used (only in case listOrderField != null) to delete object with particular orderFieldValueprotected DatabaseField
The direct field name is converted and storedprotected boolean
protected boolean
protected boolean
protected boolean
protected HistoryPolicy
protected static final String
protected DataModifyQuery
Used for insertion for m-m and dc, not used in 1-m.protected List
<Expression> protected Vector
<DatabaseField> protected DatabaseTable
Stores the reference tableprotected Vector
<DatabaseField> protected static final String
protected ModifyQuery
Used (only in case listOrderField != null) to update orderFieldValue of object with particular orderFieldValueprotected Converter
Allows user defined conversion between the object value and the database value.protected String
Fields inherited from class org.eclipse.persistence.mappings.CollectionMapping
changeOrderTargetQuery, containerPolicy, deleteAllQuery, hasCustomDeleteAllQuery, hasOrderBy, isListOrderFieldSupported, isSynchronizeOnMerge, listOrderField, mustDeleteReferenceObjectsOneByOne, orderCorrectionType
Fields inherited from class org.eclipse.persistence.mappings.ForeignReferenceMapping
batchFetchType, cascadeDetach, cascadeMerge, cascadePersist, cascadeRefresh, cascadeRemove, forceInitializationOfSelectionCriteria, hasCustomSelectionQuery, indirectionPolicy, INNER_JOIN, isCascadeOnDeleteSetOnDatabase, isPrivateOwned, joinFetch, mappedBy, NONE, OUTER_JOIN, partitioningPolicy, partitioningPolicyName, QUERY_BATCH_PARAMETER, referenceClass, referenceClassName, referenceDescriptor, relationshipPartner, relationshipPartnerAttributeName, requiresTransientWeavedFields, selectionQuery, tempInitSession
Fields inherited from class org.eclipse.persistence.mappings.DatabaseMapping
attributeAccessor, attributeName, derivedIdMapping, derivesId, descriptor, fields, isCacheable, isInSopObject, isJPAId, isLazy, isMapKeyMapping, isOptional, isPrimaryKeyMapping, isReadOnly, isRemotelyInitialized, mapsIdValue, NO_FIELDS, NO_WEIGHT, properties, unconvertedProperties, weight, WEIGHT_AGGREGATE, WEIGHT_DIRECT, WEIGHT_TO_ONE, WEIGHT_TRANSFORM
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
PUBLIC: Provide ascending order support for this direct collection mapping.void
PUBLIC: Provide descending order support for this direct collection mapping.void
addOrdering
(Expression expression) ADVANCED: Used this method to add custom ordering expressions when fetching the collection.void
addReferenceKeyField
(DatabaseField referenceForeignKeyField, DatabaseField sourcePrimaryKeyField) PUBLIC: Add the reference key field.void
addReferenceKeyFieldName
(String referenceForeignKeyFieldName, String sourcePrimaryKeyFieldName) PUBLIC: Add the name of the reference key field.protected Expression
buildBatchCriteria
(ExpressionBuilder builder, ObjectLevelReadQuery query) INTERNAL: Return the selection criteria used to IN batch fetching.void
INTERNAL: Copy of the attribute of the object.buildElementClone
(Object element, Object parent, CacheKey parentCacheKey, Integer refreshCascade, AbstractSession cloningSession, boolean isExisting, boolean isFromSharedCache) INTERNAL: Clone the element, if necessary.buildExpression
(Object queryObject, QueryByExamplePolicy policy, Expression expressionBuilder, Map processedObjects, AbstractSession session) 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.protected void
INTERNAL: Verifies listOrderField's table: it must be reference table.void
calculateDeferredChanges
(ChangeRecord changeRecord, AbstractSession session) INTERNAL: Used by AttributeLevelChangeTracking to update a changeRecord with calculated changes as apposed to detected changes.void
cascadeDiscoverAndPersistUnregisteredNewObjects
(Object object, Map newObjects, Map unregisteredExistingObjects, Map visitedObjects, UnitOfWorkImpl uow, Set cascadeErrors) INTERNAL: Cascade discover and persist new objects during commit.void
cascadePerformRemoveIfRequired
(Object object, UnitOfWorkImpl uow, Map visitedObjects) INTERNAL: Cascade perform delete through mappings that require the cascadevoid
cascadePerformRemovePrivateOwnedObjectFromChangeSetIfRequired
(Object object, UnitOfWorkImpl uow, Map visitedObjects) INTERNAL: Cascade perform removal of orphaned private owned objects from the UnitOfWorkChangeSetvoid
cascadeRegisterNewIfRequired
(Object object, UnitOfWorkImpl uow, Map visitedObjects) INTERNAL: Cascade registerNew for Create through mappings that require the cascadeclone()
INTERNAL: The mapping clones itself to create deep copy.void
collectQueryParameters
(Set<DatabaseField> cacheFields) INTERNAL: This method is used to store the FK fields that can be cached that correspond to noncacheable mappings the FK field values will be used to re-issue the query when cloning the shared cache entityvoid
compareCollectionsForChange
(Object oldCollection, Object newCollection, ChangeRecord changeRecord, AbstractSession session) INTERNAL: This method is used to calculate the differences between two collections.compareForChange
(Object clone, Object backUp, ObjectChangeSet owner, AbstractSession session) INTERNAL: This method compares the changes between two direct collections.protected boolean
compareLists
(List firstList, List secondList) Compare two lists.void
compareListsForChange
(List oldList, List newList, ChangeRecord changeRecord, AbstractSession session) INTERNAL: This method is used to calculate the differences between two Lists.boolean
compareObjects
(Object firstObject, Object secondObject, AbstractSession session) INTERNAL: Compare the attributes belonging to this mapping for the objects.void
convertClassNamesToClasses
(ClassLoader classLoader) INTERNAL: Convert all the class-name-based settings in this mapping to actual class-based settings This method is implemented by subclasses as necessary.protected Expression
protected Expression
protected void
executeBatchQuery
(DatabaseQuery query, CacheKey parentCacheKey, Map referenceDataByKey, AbstractSession session, AbstractRecord translationRow) INTERNAL: Prepare and execute the batch query and store the results for each source object in a map keyed by the mappings source keys of the source objects.protected Object
extractBatchKeyFromRow
(AbstractRecord row, AbstractSession session) INTERNAL: Extract the primary key value from the source row.protected Object
extractKeyFromTargetRow
(AbstractRecord row, AbstractSession session) INTERNAL: Extract the source primary key value from the reference direct row.void
fixRealObjectReferences
(Object object, Map<Object, ObjectDescriptor> objectInformation, Map<Object, Object> processedObjects, ObjectLevelReadQuery query, DistributedSession session) INTERNAL: At this point, we realize we don't have indirection; so we need to replace the reference object(s) with the corresponding object(s) from the remote session.protected Expression
INTERNAL: Return the base expression to use for adding fields to the query.Class
<?> PUBLIC: Some databases do not properly support all of the base data types.INTERNAL: Return the class name of the attribute type.protected ModifyQuery
protected ModifyQuery
protected ModifyQuery
INTERNAL: Return the direct field.PUBLIC: Returns the name of the field name in the reference table.INTERNAL: Return source key fields for translation by an AggregateObjectMappinggetFieldValue
(Object attributeValue, AbstractSession session) INTERNAL: Convert the attribute value to a field value.PUBLIC: Allow history support on the reference table.protected DataModifyQuery
getJoinCriteria
(ObjectExpression context, Expression base) INTERNAL: Returns the join criteria stored in the mapping selection query.getObjectCorrespondingTo
(Object object, DistributedSession session, Map<Object, ObjectDescriptor> objectDescriptors, Map<Object, Object> processedObjects, ObjectLevelReadQuery query) INTERNAL: return the object on the client corresponding to the specified object.getObjectValue
(Object fieldValue, AbstractSession session) INTERNAL: Convert the field value to an attribute value.PUBLIC: Return the order by expression.INTERNAL: Return null if this mapping is used in an order by.Class
<?> INTERNAL: This cannot be used with direct collection mappings.INTERNAL: Returns the reference class name.INTERNAL: There is none on direct collection.INTERNAL: Return the reference key field names associated with the mapping.INTERNAL: Return the reference key fields.INTERNAL: Return the direct table.PUBLIC: Returns the name of the reference tablePUBLIC: Returns the qualified name of the reference table.INTERNAL: Return the relationshipPartner mapping for this bi-directional mapping.INTERNAL: Returns the set of fields that should be selected to build this mapping's value(s).protected ContainerPolicy
INTERNAL: Get the container policy from the selection query for this mapping.INTERNAL: Returns the table(s) that should be selected to build this mapping's value(s).PUBLIC: Return the source key field names associated with the mapping.INTERNAL: Return the source key fields.protected ModifyQuery
PUBLIC: Return the converter on the mapping.protected boolean
protected boolean
protected boolean
protected boolean
boolean
INTERNAL: Indicates whether the mapping (or at least one of its nested mappings, at any nested depth) references an entity.void
initialize
(AbstractSession session) INTERNAL: Initialize and validate the mapping properties.protected void
initializeDeleteAllQuery
(AbstractSession session) Initialize delete all query.protected void
protected void
initializeDeleteNullQuery
(AbstractSession session) protected void
initializeDeleteQuery
(AbstractSession session) protected void
initializeDirectField
(AbstractSession session) The field name on the reference table is initialized and cached.protected void
initializeInsertQuery
(AbstractSession session) Initialize insert query.protected void
initializeListOrderField
(AbstractSession session) INTERNAL: Initializes listOrderField.protected void
There is no reference descriptorprotected void
initializeReferenceKeys
(AbstractSession session) The reference keys on the reference table are initializedprotected void
initializeReferenceTable
(AbstractSession session) Set the table qualifier on the reference table if requiredprotected void
protected void
initializeSelectionQuery
(AbstractSession session) The selection query is initializedprotected void
protected void
initializeSourceKeys
(AbstractSession session) The source keys are initializedprotected void
INTERNAL: If a user does not specify the source key then the primary keys of the source table are used.protected void
protected void
INTERNAL: Used by DirectMapMapping to rebuild select query.boolean
INTERNAL: DirectCollectionMapping contents should not be considered for addition to the UnitOfWork private owned objects list for removal.boolean
INTERNAL Return true if this mapping supports cascaded version optimistic locking.boolean
INTERNAL:boolean
INTERNAL:boolean
INTERNAL: Return if this mapping support joining.protected boolean
INTERNAL: Checks if source and target keys are mentioned by the user or not.boolean
INTERNAL: Return whether this mapping should be traversed when we are lockingboolean
isOwned()
INTERNAL:boolean
INTERNAL: All relational mappings should implement this method to return true.void
iterateOnElement
(DescriptorIterator iterator, Object element) INTERNAL: Iterate on the specified element.void
iterateOnRealAttributeValue
(DescriptorIterator iterator, Object realAttributeValue) INTERNAL: Iterate on the attribute value.protected void
mergeAddRemoveChanges
(Object valueOfTarget, Object delegateTarget, DirectCollectionChangeRecord changeRecord, MergeManager mergeManager, AbstractSession session) INTERNAL: Merge changes by adding and removing from the change record to the target object, and its delegate object if instance of IndirectCollection.void
mergeChangesIntoObject
(Object target, ChangeRecord changeRecord, Object source, MergeManager mergeManager, AbstractSession targetSession) INTERNAL: Merge changes from the source to the target object.void
mergeIntoObject
(Object target, boolean isTargetUnInitialized, Object source, MergeManager mergeManager, AbstractSession targetSession) INTERNAL: Merge changes from the source to the target object.void
performDataModificationEvent
(Object[] event, AbstractSession session) INTERNAL: Perform the commit event.void
postCalculateChanges
(ChangeRecord changeRecord, UnitOfWorkImpl uow) INTERNAL: Overridden by mappings that require additional processing of the change record after the record has been calculated.void
postInsert
(WriteObjectQuery query) INTERNAL: Insert the private owned object.void
postUpdate
(WriteObjectQuery writeQuery) INTERNAL: Update private owned part.protected void
postUpdateWithChangeSet
(WriteObjectQuery writeQuery) INTERNAL: Update private owned part.protected void
postUpdateWithChangeSetListOrder
(WriteObjectQuery writeQuery) INTERNAL: Update private owned part.void
preDelete
(DeleteObjectQuery query) INTERNAL: Delete private owned part.INTERNAL: Clone and prepare the selection query as a nested batch read query.prepareNestedJoins
(JoinedAttributeManager joinManager, ObjectBuildingQuery baseQuery, AbstractSession session) INTERNAL: Clone and prepare the joined direct query.protected void
prepareTranslationRow
(AbstractRecord translationRow, Object object, ClassDescriptor descriptor, AbstractSession session) INTERNAL: The translation row may require additional fields than the primary key if the mapping in not on the primary key.void
recordPrivateOwnedRemovals
(Object object, UnitOfWorkImpl uow) INTERNAL: Overridden by mappings that require additional processing of the change record after the record has been calculated.void
remoteInitialization
(DistributedSession session) INTERNAL: Once descriptors are serialized to the remote session.replaceValueHoldersIn
(Object object, RemoteSessionController controller) INTERNAL: replace the value holders in the specified reference object(s)void
setAttributeClassification
(Class<?> attributeClassification) PUBLIC: Some databases do not properly support all of the base data types.void
setAttributeClassificationName
(String attributeClassificationName) INTERNAL: Set the name of the class for MW usage.void
setContainerPolicy
(ContainerPolicy containerPolicy) ADVANCED: Configure the mapping to use a container policy.void
PUBLIC: The default delete by index query for this mapping can be overridden by specifying the new query.void
setCustomDeleteQuery
(ModifyQuery query) PUBLIC: The default delete query for this mapping can be overridden by specifying the new query.void
PUBLIC: The default insert query for mapping can be overridden by specifying the new query.void
PUBLIC: The default delete by index query for this mapping can be overridden by specifying the new query.protected void
setDeleteQuery
(ModifyQuery query) void
setDeleteSQLString
(String sqlString) PUBLIC: Set the receiver's delete SQL string.void
setDirectField
(DatabaseField field) PUBLIC: Set the direct field in the reference table.void
setDirectFieldClassification
(Class<?> fieldType) ADVANCED: Set the class type of the field value.void
setDirectFieldClassificationName
(String className) ADVANCED: Set the class type of the field value.void
setDirectFieldName
(String fieldName) PUBLIC: Set the direct field name in the reference table.protected void
setHasCustomDeleteQuery
(boolean bool) protected void
setHasCustomInsertQuery
(boolean bool) void
setHistoryPolicy
(HistoryPolicy policy) PUBLIC: Support history on the reference table.protected void
setInsertQuery
(DataModifyQuery insertQuery) void
setInsertSQLString
(String sqlString) PUBLIC: Set the receiver's insert SQL string.void
setReferenceClass
(Class<?> referenceClass) INTERNAL: This cannot be used with direct collection mappings.void
setReferenceClassName
(String referenceClassName) INTERNAL: Used by MW.void
setReferenceKeyFieldName
(String fieldName) PUBLIC: Set the name of the reference key field.void
setReferenceKeyFieldNames
(Vector fieldNames) INTERNAL: Set the reference key field names associated with the mapping.void
setReferenceKeyFields
(Vector<DatabaseField> aVector) INTERNAL: Set the reference fields.void
setReferenceTable
(DatabaseTable table) INTERNAL: Set the reference table.void
setReferenceTableName
(String tableName) PUBLIC: Set the reference table name.void
setSelectionCriteria
(Expression anExpression) PUBLIC: Sets the selection criteria to be used as a where clause to read reference objects.protected void
setSelectionQueryContainerPolicy
(ContainerPolicy containerPolicy) INTERNAL: Set the container policy on the selection query for this mapping.void
setSessionName
(String name) PUBLIC: Set the name of the session to execute the mapping's queries under.void
setSourceKeyFieldNames
(Vector fieldNames) INTERNAL: Set the source key field names associated with the mapping.void
setSourceKeyFields
(Vector<DatabaseField> sourceKeyFields) INTERNAL: Set the source fields.void
setValueConverter
(Converter valueConverter) PUBLIC: Set the converter on the mapping.void
setValueConverterClassName
(String valueConverterClassName) PUBLIC: Set the converter class name on the mapping.boolean
INTERNAL: Indicates whether getListOrderFieldExpression method should create field expression on table expression.protected void
simpleAddToCollectionChangeRecord
(Object objectToAdd, Integer index, boolean isSet, ObjectChangeSet changeSet, AbstractSession session, boolean isChangeApplied) void
simpleAddToCollectionChangeRecord
(Object referenceKey, Object objectToAdd, ObjectChangeSet changeSet, AbstractSession session) ADVANCED: This method is used to have an object add to a collection once the changeSet is applied The referenceKey parameter should only be used for direct Maps.protected void
simpleRemoveFromCollectionChangeRecord
(Object objectToRemove, Integer index, boolean isSet, ObjectChangeSet changeSet, AbstractSession session, boolean isChangeApplied) void
simpleRemoveFromCollectionChangeRecord
(Object referenceKey, Object objectToRemove, ObjectChangeSet changeSet, AbstractSession session) ADVANCED: This method is used to have an object removed from a collection once the changeSet is applied The referenceKey parameter should only be used for direct Maps.void
updateChangeRecord
(Object clone, Object newValue, Object oldValue, ObjectChangeSet objectChangeSet, UnitOfWorkImpl uow) INTERNAL: Either create a new change record or update with the new value.void
updateCollectionChangeRecord
(CollectionChangeEvent event, ObjectChangeSet changeSet, UnitOfWorkImpl uow) INTERNAL: Add or removes a new value and its change set to the collection change record based on the event passed in.void
useMapClass
(Class<?> concreteClass, String methodName) PUBLIC: It is illegal to use a Map as the container of a DirectCollectionMapping.valueFromRow
(AbstractRecord row, JoinedAttributeManager joinManager, ObjectBuildingQuery sourceQuery, CacheKey cacheKey, AbstractSession session, boolean isTargetProtected, Boolean[] wasCacheUsed) INTERNAL: Return the value of the reference attribute or a value holder.protected Object
valueFromRowInternalWithJoin
(AbstractRecord row, JoinedAttributeManager joinManager, ObjectBuildingQuery sourceQuery, CacheKey parentCacheKey, AbstractSession executionSession, boolean isTargetProtected) INTERNAL: Return the value of the field from the row or a value holder on the query to obtain the object.boolean
verifyDelete
(Object object, AbstractSession session) INTERNAL: Checks if object is deleted from the database or not.Methods inherited from class org.eclipse.persistence.mappings.CollectionMapping
addAggregateOrderBy, addAscendingOrdering, addDescendingOrdering, addOrderBy, buildBackupCloneForPartObject, buildChangeRecord, buildCloneForPartObject, buildContainerClone, buildElementUnitOfWorkClone, buildReferencesPKList, compareLists, compareListsAndWrite, compareObjectsAndWrite, compareObjectsWithoutPrivateOwned, compareObjectsWithPrivateOwned, copyElement, extractResultFromBatchQuery, getContainerPolicy, getDeleteAllQuery, getListOrderField, getOrderByQueryKeyExpressions, getOrderCorrectionType, getRealCollectionAttributeValueFromObject, getTargetPrimaryKeyFields, hasCustomDeleteAllQuery, hasOrderBy, initializeChangeOrderTargetQuery, initializeListOrderFieldTable, isAttributeValueInstantiatedOrChanged, isChangeTrackingSupported, isCollectionMapping, isListOrderFieldSupported, isMapKeyObjectRelationship, load, loadAll, mustDeleteReferenceObjectsOneByOne, objectAddedDuringUpdate, objectOrderChangedDuringUpdate, objectRemovedDuringUpdate, objectUnchangedDuringUpdate, objectUnchangedDuringUpdate, postDelete, postInitialize, postPrepareNestedBatchQuery, preInsert, preUpdate, readPrivateOwnedForObject, setChangeListener, setCustomDeleteAllQuery, setDeleteAllCall, setDeleteAllQuery, setDeleteAllSQLString, setHasCustomDeleteAllQuery, setListOrderField, setListOrderFieldName, setMustDeleteReferenceObjectsOneByOne, setOrderCorrectionType, setUseLazyInstantiationForIndirectCollection, shouldUseLazyInstantiationForIndirectCollection, updateChangeRecordForSelfMerge, useCollectionClass, useCollectionClassName, useListClassName, useMapClass, useMapClassName, useSortedSetClass, useSortedSetClassName, useSortedSetClassName, useTransparentCollection, useTransparentList, useTransparentMap, useTransparentSet, validateBeforeInitialization, valueFromPKList, writeChanges
Methods inherited from class org.eclipse.persistence.mappings.ForeignReferenceMapping
addForeignKeyField, addTargetForeignKeyField, batchedValueFromRow, buildBackupClone, buildClone, buildCloneFromRow, checkCacheForBatchKey, createCloneValueHolder, dontDoMerge, dontUseBatchReading, dontUseIndirection, extendPessimisticLockScopeInSourceQuery, extendPessimisticLockScopeInTargetQuery, fixObjectReferences, getAttributeValueFromObject, getAttributeValueWithClonedValueHolders, getBatchFetchType, getExtendPessimisticLockScopeDedicatedQuery, getIndirectionPolicy, getJoinFetch, getMappedBy, getPartitioningPolicy, getPartitioningPolicyName, getRealAttributeValueFromAttribute, getRelationshipPartnerAttributeName, getSelectionCriteria, getSelectionQuery, getTempSession, getValueFromRemoteValueHolder, hasCustomSelectionQuery, hasDependency, instantiateAttribute, isAttributeValueFromObjectInstantiated, isAttributeValueFullyBuilt, isAttributeValueInstantiated, isCascadeDetach, isCascadeMerge, isCascadeOnDeleteSetOnDatabase, isCascadePersist, isCascadeRefresh, isCascadeRemove, isExtendingPessimisticLockScope, isForeignReferenceMapping, isInnerJoinFetched, isJoinFetched, isLazy, isOuterJoinFetched, isPrivateOwned, iterate, mergeRemoteValueHolder, preInitialize, prepareHistoricalQuery, prepareNestedJoinQueryClone, privateOwnedRelationship, readFromRowIntoObject, requiresTransientWeavedFields, setBatchFetchType, setCascadeAll, setCascadeDetach, setCascadeMerge, setCascadePersist, setCascadeRefresh, setCascadeRemove, setCustomSelectionQuery, setForceInitializationOfSelectionCriteria, setHasCustomSelectionQuery, setIndirectionPolicy, setIsCacheable, setIsCascadeOnDeleteSetOnDatabase, setIsPrivateOwned, setJoinFetch, setMappedBy, setPartitioningPolicy, setPartitioningPolicyName, setRealAttributeValueInObject, setReferenceDescriptor, setRelationshipPartner, setRelationshipPartnerAttributeName, setRequiresTransientWeavedFields, setSelectionCall, setSelectionQuery, setSelectionSQLString, setShouldExtendPessimisticLockScope, setTempSession, setUsesBatchReading, setUsesIndirection, shouldExtendPessimisticLockScope, shouldExtendPessimisticLockScopeInDedicatedQuery, shouldExtendPessimisticLockScopeInSourceQuery, shouldExtendPessimisticLockScopeInTargetQuery, shouldForceInitializationOfSelectionCriteria, shouldInitializeSelectionCriteria, shouldMergeCascadeParts, shouldMergeCascadeReference, shouldObjectModifyCascadeToParts, shouldRefreshCascadeParts, shouldUseBatchReading, shouldUseValueFromRowWithJoin, trimRowForJoin, trimRowForJoin, useBasicIndirection, useBatchReading, useContainerIndirection, useInnerJoinFetch, useOuterJoinFetch, usesIndirection, useWeavedIndirection, valueFromRowInternal, valueFromRowInternal
Methods inherited from class org.eclipse.persistence.mappings.DatabaseMapping
addUnconvertedProperty, buildObjectJoinExpression, buildObjectJoinExpression, buildShallowOriginalFromRow, cloneFields, collectFields, convertConverterClassNamesToClasses, derivesId, earlyPreDelete, extractNestedExpressions, extractNestedNonAggregateExpressions, getAttributeAccessor, getAttributeName, getDerivedIdMapping, getDescriptor, getField, getFieldClassification, getFields, getGetMethodName, getMapsIdValue, getProperties, getProperty, getRealAttributeValueFromObject, getSetMethodName, getUnconvertedProperties, getWeight, hasConstraintDependency, hasInverseConstraintDependency, hasMapsIdValue, hasRootExpressionThatShouldUseOuterJoin, hasUnconvertedProperties, isAbstractColumnMapping, isAbstractCompositeCollectionMapping, isAbstractCompositeDirectCollectionMapping, isAbstractCompositeObjectMapping, isAbstractDirectMapping, isAggregateCollectionMapping, isAggregateMapping, isAggregateObjectMapping, isCacheable, isCloningRequired, isDatabaseMapping, isDirectMapMapping, isDirectToFieldMapping, isDirectToXMLTypeMapping, isEISMapping, isInAndOutSopObject, isInOnlySopObject, isInSopObject, isJPAId, isManyToManyMapping, isManyToOneMapping, isMapKeyMapping, isMultitenantPrimaryKeyMapping, isNestedTableMapping, isObjectReferenceMapping, isOneToManyMapping, isOneToOneMapping, isOptional, isOutOnlySopObject, isOutSopObject, isPrimaryKeyMapping, isReadOnly, isReferenceMapping, isRemotelyInitialized, isStructureMapping, isTransformationMapping, isUnidirectionalOneToManyMapping, isUsingMethodAccess, isVariableOneToOneMapping, isWriteOnly, isXMLMapping, postCalculateChangesOnDeleted, postInitializeSourceAndTargetExpressions, prepareCascadeLockingPolicy, readFromResultSetIntoObject, readOnly, readWrite, rehashFieldDependancies, remotelyInitialized, setAttributeAccessor, setAttributeName, setAttributeValueInObject, setDerivedIdMapping, setDerivesId, setDescriptor, setFields, setGetMethodName, setIsInAndOutSopObject, setIsInSopObject, setIsJPAId, setIsLazy, setIsMapKeyMapping, setIsOptional, setIsOutSopObject, setIsPrimaryKeyMapping, setIsReadOnly, setMapsIdValue, setProperties, setProperty, setSetMethodName, setWeight, toString, validateAfterInitialization, valueFromObject, valueFromResultSet, valueFromRow, writeFromAttributeIntoRow, writeFromObjectIntoRow, writeFromObjectIntoRowForShallowInsert, writeFromObjectIntoRowForShallowInsertWithChangeRecord, writeFromObjectIntoRowForUpdate, writeFromObjectIntoRowForUpdateAfterShallowInsert, writeFromObjectIntoRowForUpdateBeforeShallowDelete, writeFromObjectIntoRowForWhereClause, writeFromObjectIntoRowWithChangeRecord, writeInsertFieldsIntoRow, writeUpdateFieldsIntoRow
-
Field Details
-
Delete
Used for data modification events.- See Also:
-
Insert
- See Also:
-
DeleteAll
- See Also:
-
DeleteAtIndex
- See Also:
-
UpdateAtIndex
- See Also:
-
valueConverter
Allows user defined conversion between the object value and the database value. -
valueConverterClassName
-
orderByExpressions
-
referenceTable
Stores the reference table -
directField
The direct field name is converted and stored -
sourceKeyFields
-
referenceKeyFields
-
insertQuery
Used for insertion for m-m and dc, not used in 1-m. -
changeSetDeleteQuery
Used for deletion when ChangeSets are used -
changeSetDeleteNullQuery
-
hasCustomDeleteQuery
protected boolean hasCustomDeleteQuery -
hasCustomInsertQuery
protected boolean hasCustomInsertQuery -
historyPolicy
-
deleteAtIndexQuery
Used (only in case listOrderField != null) to delete object with particular orderFieldValue -
updateAtIndexQuery
Used (only in case listOrderField != null) to update orderFieldValue of object with particular orderFieldValue -
hasCustomDeleteAtIndexQuery
protected boolean hasCustomDeleteAtIndexQuery -
hasCustomUpdateAtIndexQuery
protected boolean hasCustomUpdateAtIndexQuery -
attributeClassification
- Since:
- Java Persistence API 2.0 Referenced by MapAttributeImpl to pick up the BasicMap value parameter type To specify the conversion type
-
attributeClassificationName
-
-
Constructor Details
-
DirectCollectionMapping
public DirectCollectionMapping()PUBLIC: Default constructor.
-
-
Method Details
-
addAscendingOrdering
public void addAscendingOrdering()PUBLIC: Provide ascending order support for this direct collection mapping. -
addDescendingOrdering
public void addDescendingOrdering()PUBLIC: Provide descending order support for this direct collection mapping. -
addOrdering
ADVANCED: Used this method to add custom ordering expressions when fetching the collection. This could be things like expressions using a functions like UPPER or NULLS LAST etc. -
isRelationalMapping
public boolean isRelationalMapping()Description copied from class:DatabaseMapping
INTERNAL: All relational mappings should implement this method to return true.- Overrides:
isRelationalMapping
in classDatabaseMapping
-
getValueConverter
PUBLIC: Return the converter on the mapping. A converter can be used to convert between the direct collection's object value and database value. -
setValueConverter
PUBLIC: Set the converter on the mapping. A converter can be used to convert between the direct collection's object value and database value. -
setValueConverterClassName
PUBLIC: Set the converter class name on the mapping. Initialized in convertClassNamesToClasses. A converter can be used to convert between the direct collection's object value and database value. -
addReferenceKeyField
public void addReferenceKeyField(DatabaseField referenceForeignKeyField, DatabaseField sourcePrimaryKeyField) PUBLIC: Add the reference key field. This is used for composite reference keys. This is the foreign key field in the direct table referencing the primary key of the source object. Both the reference field and the source field that it references must be provided. -
addReferenceKeyFieldName
public void addReferenceKeyFieldName(String referenceForeignKeyFieldName, String sourcePrimaryKeyFieldName) PUBLIC: Add the name of the reference key field. This is used for composite reference keys. This is the foreign key field in the direct table referencing the primary key of the source object. Both the reference field name and the name of the source field that it references must be provided. -
prepareNestedBatchQuery
INTERNAL: Clone and prepare the selection query as a nested batch read query. This is used for nested batch reading.- Overrides:
prepareNestedBatchQuery
in classForeignReferenceMapping
-
prepareNestedJoins
public ObjectLevelReadQuery prepareNestedJoins(JoinedAttributeManager joinManager, ObjectBuildingQuery baseQuery, AbstractSession session) INTERNAL: Clone and prepare the joined direct query. Since direct-collection does not build objects a nest query is not required.- Overrides:
prepareNestedJoins
in classForeignReferenceMapping
-
valueFromRowInternalWithJoin
protected Object valueFromRowInternalWithJoin(AbstractRecord row, JoinedAttributeManager joinManager, ObjectBuildingQuery sourceQuery, CacheKey parentCacheKey, AbstractSession executionSession, boolean isTargetProtected) throws DatabaseException INTERNAL: Return the value of the field from the row or a value holder on the query to obtain the object.- Overrides:
valueFromRowInternalWithJoin
in classCollectionMapping
- Throws:
DatabaseException
-
buildCopy
INTERNAL: Copy of the attribute of the object. This is NOT used for unit of work but for templatizing an object.- Overrides:
buildCopy
in classCollectionMapping
- Parameters:
copy
- TODOoriginal
- TODOgroup
- TODO
-
buildElementClone
public Object buildElementClone(Object element, Object parent, CacheKey parentCacheKey, Integer refreshCascade, AbstractSession cloningSession, boolean isExisting, boolean isFromSharedCache) INTERNAL: Clone the element, if necessary. DirectCollections hold on to objects that do not have Descriptors (e.g. int, String). These objects do not need to be cloned, unless they use a converter - they are immutable.- Overrides:
buildElementClone
in classCollectionMapping
-
buildExpression
public Expression buildExpression(Object queryObject, QueryByExamplePolicy policy, Expression expressionBuilder, Map processedObjects, AbstractSession session) 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.- Overrides:
buildExpression
in classCollectionMapping
- Parameters:
queryObject
- TODOpolicy
- TODOexpressionBuilder
- TODOprocessedObjects
- TODOsession
- TODO- Returns:
- TODO
-
buildListOrderField
protected void buildListOrderField()INTERNAL: Verifies listOrderField's table: it must be reference table. Precondition: listOrderField != null.- Overrides:
buildListOrderField
in classCollectionMapping
-
cascadePerformRemoveIfRequired
INTERNAL: Cascade perform delete through mappings that require the cascade- Overrides:
cascadePerformRemoveIfRequired
in classCollectionMapping
- Parameters:
object
- TODOuow
- TODOvisitedObjects
- TODO
-
cascadePerformRemovePrivateOwnedObjectFromChangeSetIfRequired
public void cascadePerformRemovePrivateOwnedObjectFromChangeSetIfRequired(Object object, UnitOfWorkImpl uow, Map visitedObjects) INTERNAL: Cascade perform removal of orphaned private owned objects from the UnitOfWorkChangeSet- Overrides:
cascadePerformRemovePrivateOwnedObjectFromChangeSetIfRequired
in classCollectionMapping
- Parameters:
object
- TODOuow
- TODOvisitedObjects
- TODO
-
cascadeRegisterNewIfRequired
INTERNAL: Cascade registerNew for Create through mappings that require the cascade- Overrides:
cascadeRegisterNewIfRequired
in classCollectionMapping
- Parameters:
object
- TODOuow
- TODOvisitedObjects
- TODO
-
cascadeDiscoverAndPersistUnregisteredNewObjects
public void cascadeDiscoverAndPersistUnregisteredNewObjects(Object object, Map newObjects, Map unregisteredExistingObjects, Map visitedObjects, UnitOfWorkImpl uow, Set cascadeErrors) INTERNAL: Cascade discover and persist new objects during commit.- Overrides:
cascadeDiscoverAndPersistUnregisteredNewObjects
in classCollectionMapping
- Parameters:
object
- TODOnewObjects
- TODOunregisteredExistingObjects
- TODOvisitedObjects
- TODOuow
- TODOcascadeErrors
- TODO
-
clone
INTERNAL: The mapping clones itself to create deep copy.- Overrides:
clone
in classCollectionMapping
- Returns:
- new instance of itself
-
compareCollectionsForChange
public void compareCollectionsForChange(Object oldCollection, Object newCollection, ChangeRecord changeRecord, AbstractSession session) INTERNAL: This method is used to calculate the differences between two collections.- Overrides:
compareCollectionsForChange
in classCollectionMapping
-
compareListsForChange
public void compareListsForChange(List oldList, List newList, ChangeRecord changeRecord, AbstractSession session) INTERNAL: This method is used to calculate the differences between two Lists. -
compareForChange
public ChangeRecord compareForChange(Object clone, Object backUp, ObjectChangeSet owner, AbstractSession session) INTERNAL: This method compares the changes between two direct collections. Comparisons are made on equality not identity.- Overrides:
compareForChange
in classCollectionMapping
- Parameters:
clone
- TODObackUp
- TODOowner
- TODOsession
- TODO- Returns:
- prototype.changeset.ChangeRecord TODO
-
compareObjects
INTERNAL: Compare the attributes belonging to this mapping for the objects.- Overrides:
compareObjects
in classCollectionMapping
- Parameters:
firstObject
- TODOsecondObject
- TODOsession
- TODO- Returns:
- TODO
-
compareLists
Compare two lists. For equality the order of the elements should be the same. Used only if listOrderField != null -
convertClassNamesToClasses
INTERNAL: Convert all the class-name-based settings in this mapping to actual class-based settings This method is implemented by subclasses as necessary.- Overrides:
convertClassNamesToClasses
in classCollectionMapping
- Parameters:
classLoader
- TODO
-
extractKeyFromTargetRow
INTERNAL: Extract the source primary key value from the reference direct row. Used for batch reading, most following same order and fields as in the mapping.- Overrides:
extractKeyFromTargetRow
in classCollectionMapping
-
extractBatchKeyFromRow
INTERNAL: Extract the primary key value from the source row. Used for batch reading, most following same order and fields as in the mapping.- Overrides:
extractBatchKeyFromRow
in classForeignReferenceMapping
-
buildBatchCriteria
INTERNAL: Return the selection criteria used to IN batch fetching.- Overrides:
buildBatchCriteria
in classForeignReferenceMapping
-
executeBatchQuery
protected void executeBatchQuery(DatabaseQuery query, CacheKey parentCacheKey, Map referenceDataByKey, AbstractSession session, AbstractRecord translationRow) INTERNAL: Prepare and execute the batch query and store the results for each source object in a map keyed by the mappings source keys of the source objects.- Overrides:
executeBatchQuery
in classCollectionMapping
-
fixRealObjectReferences
public void fixRealObjectReferences(Object object, Map<Object, ObjectDescriptor> objectInformation, Map<Object, Object> processedObjects, ObjectLevelReadQuery query, DistributedSession session) INTERNAL: At this point, we realize we don't have indirection; so we need to replace the reference object(s) with the corresponding object(s) from the remote session. The reference objects for a DirectCollectionMapping are primitives, so they do not need to be replaced.- Overrides:
fixRealObjectReferences
in classCollectionMapping
- Parameters:
object
- TODOobjectInformation
- TODOprocessedObjects
- TODOquery
- TODOsession
- TODO
-
getAttributeClassification
PUBLIC: Some databases do not properly support all of the base data types. For these databases, the base data type must be explicitly specified in the mapping to tell EclipseLink to force the instance variable value to that data type.- Overrides:
getAttributeClassification
in classDatabaseMapping
- Returns:
- TODO
- Since:
- Java Persistence API 2.0
-
getAttributeClassificationName
INTERNAL: Return the class name of the attribute type. This is only used by the MW.- Since:
- Java Persistence API 2.0
-
getDeleteQuery
-
getDeleteNullQuery
-
getDeleteAtIndexQuery
-
getUpdateAtIndexQuery
-
getSelectFields
INTERNAL: Returns the set of fields that should be selected to build this mapping's value(s). This is used by expressions to determine which fields to include in the select clause for non-object expressions.- Overrides:
getSelectFields
in classDatabaseMapping
- Returns:
- TODO
-
getSelectTables
INTERNAL: Returns the table(s) that should be selected to build this mapping's value(s). This is used by expressions to determine which tables to include in the from clause for non-object expressions.- Overrides:
getSelectTables
in classDatabaseMapping
- Returns:
- TODO
-
getDirectField
INTERNAL: Return the direct field. This is the field in the direct table to store the values. -
getDirectFieldName
PUBLIC: Returns the name of the field name in the reference table. -
getInsertQuery
-
getJoinCriteria
INTERNAL: Returns the join criteria stored in the mapping selection query. This criteria is used to read reference objects across the tables from the database.- Overrides:
getJoinCriteria
in classCollectionMapping
-
getObjectCorrespondingTo
public Object getObjectCorrespondingTo(Object object, DistributedSession session, Map<Object, ObjectDescriptor> objectDescriptors, Map<Object, Object> processedObjects, ObjectLevelReadQuery query) INTERNAL: return the object on the client corresponding to the specified object. DirectCollections do not have to worry about maintaining object identity.- Overrides:
getObjectCorrespondingTo
in classCollectionMapping
- Parameters:
object
- TODOsession
- TODOobjectDescriptors
- TODOprocessedObjects
- TODOquery
- TODO- Returns:
- TODO
-
getOrderByExpressions
PUBLIC: Return the order by expression. -
getOrderByNormalizedExpressions
INTERNAL: Return null if this mapping is used in an order by.- Overrides:
getOrderByNormalizedExpressions
in classForeignReferenceMapping
-
getHistoryPolicy
PUBLIC: Allow history support on the reference table. -
getSelectionQueryContainerPolicy
INTERNAL: Get the container policy from the selection query for this mapping.- Overrides:
getSelectionQueryContainerPolicy
in classCollectionMapping
-
getReferenceClass
INTERNAL: This cannot be used with direct collection mappings.- Overrides:
getReferenceClass
in classForeignReferenceMapping
-
getReferenceClassName
Description copied from class:ForeignReferenceMapping
INTERNAL: Returns the reference class name.- Overrides:
getReferenceClassName
in classForeignReferenceMapping
-
getReferenceDescriptor
INTERNAL: There is none on direct collection.- Overrides:
getReferenceDescriptor
in classForeignReferenceMapping
- Returns:
- TODO
-
getReferenceKeyFieldNames
INTERNAL: Return the reference key field names associated with the mapping. These are in-order with the sourceKeyFieldNames. -
getReferenceKeyFields
INTERNAL: Return the reference key fields. -
getReferenceTable
INTERNAL: Return the direct table. This is the table to store the values. -
getReferenceTableName
PUBLIC: Returns the name of the reference table -
getReferenceTableQualifiedName
PUBLIC: Returns the qualified name of the reference table. -
getRelationshipPartner
INTERNAL: Return the relationshipPartner mapping for this bi-directional mapping. If the relationshipPartner is null then this is a uni-directional mapping. DirectCollectionMapping can not be part of a bi-directional mapping- Overrides:
getRelationshipPartner
in classForeignReferenceMapping
-
getSourceKeyFieldNames
PUBLIC: Return the source key field names associated with the mapping. These are in-order with the referenceKeyFieldNames. -
getSourceKeyFields
INTERNAL: Return the source key fields. -
hasCustomDeleteQuery
protected boolean hasCustomDeleteQuery() -
hasCustomInsertQuery
protected boolean hasCustomInsertQuery() -
hasCustomDeleteAtIndexQuery
protected boolean hasCustomDeleteAtIndexQuery() -
hasCustomUpdateAtIndexQuery
protected boolean hasCustomUpdateAtIndexQuery() -
hasNestedIdentityReference
public boolean hasNestedIdentityReference()INTERNAL: Indicates whether the mapping (or at least one of its nested mappings, at any nested depth) references an entity. To return true the mapping (or nested mapping) should be ForeignReferenceMapping with non-null and non-aggregate reference descriptor.- Overrides:
hasNestedIdentityReference
in classForeignReferenceMapping
-
initialize
INTERNAL: Initialize and validate the mapping properties.- Overrides:
initialize
in classCollectionMapping
- Throws:
DescriptorException
-
initializeListOrderField
INTERNAL: Initializes listOrderField. Precondition: listOrderField != null.- Overrides:
initializeListOrderField
in classCollectionMapping
-
initializeDeleteAllQuery
Initialize delete all query. This query is used to delete the collection of objects from the reference table. -
initializeDeleteQuery
-
initializeDeleteNullQuery
-
initializeDeleteAtIndexQuery
-
initializeUpdateAtIndexQuery
-
shouldUseListOrderFieldTableExpression
public boolean shouldUseListOrderFieldTableExpression()INTERNAL: Indicates whether getListOrderFieldExpression method should create field expression on table expression.- Overrides:
shouldUseListOrderFieldTableExpression
in classCollectionMapping
-
createWhereClauseForDeleteQuery
-
createWhereClauseForDeleteNullQuery
-
initializeDirectField
The field name on the reference table is initialized and cached.- Throws:
DescriptorException
-
initializeInsertQuery
Initialize insert query. This query is used to insert the collection of objects into the reference table. -
initializeReferenceDescriptor
There is no reference descriptor- Overrides:
initializeReferenceDescriptor
in classForeignReferenceMapping
-
initializeReferenceKeys
The reference keys on the reference table are initialized- Throws:
DescriptorException
-
initializeReferenceTable
Set the table qualifier on the reference table if required- Throws:
DescriptorException
-
initializeSelectionCriteria
-
initializeSelectionQuery
The selection query is initialized- Overrides:
initializeSelectionQuery
in classForeignReferenceMapping
-
initializeSelectionStatement
-
initializeSourceKeys
The source keys are initialized -
initializeSourceKeysWithDefaults
INTERNAL: If a user does not specify the source key then the primary keys of the source table are used. -
getAdditionalFieldsBaseExpression
INTERNAL: Return the base expression to use for adding fields to the query. This is the reference table.- Overrides:
getAdditionalFieldsBaseExpression
in classCollectionMapping
-
isDirectCollectionMapping
public boolean isDirectCollectionMapping()INTERNAL:- Overrides:
isDirectCollectionMapping
in classDatabaseMapping
-
isElementCollectionMapping
public boolean isElementCollectionMapping()INTERNAL:- Overrides:
isElementCollectionMapping
in classDatabaseMapping
-
isJoiningSupported
public boolean isJoiningSupported()INTERNAL: Return if this mapping support joining.- Overrides:
isJoiningSupported
in classForeignReferenceMapping
-
isKeyForSourceSpecified
protected boolean isKeyForSourceSpecified()INTERNAL: Checks if source and target keys are mentioned by the user or not. -
isLockableMapping
public boolean isLockableMapping()INTERNAL: Return whether this mapping should be traversed when we are locking- Overrides:
isLockableMapping
in classForeignReferenceMapping
-
isOwned
public boolean isOwned()INTERNAL:- Overrides:
isOwned
in classDatabaseMapping
-
iterateOnRealAttributeValue
INTERNAL: Iterate on the attribute value. The value holder has already been processed. PERF: Avoid iteration if not required.- Overrides:
iterateOnRealAttributeValue
in classCollectionMapping
-
iterateOnElement
INTERNAL: Iterate on the specified element.- Overrides:
iterateOnElement
in classCollectionMapping
-
mergeChangesIntoObject
public void mergeChangesIntoObject(Object target, ChangeRecord changeRecord, Object source, MergeManager mergeManager, AbstractSession targetSession) INTERNAL: Merge changes from the source to the target object. Because this is a collection mapping, values are added to or removed from the collection based on the changeset- Overrides:
mergeChangesIntoObject
in classCollectionMapping
-
mergeAddRemoveChanges
protected void mergeAddRemoveChanges(Object valueOfTarget, Object delegateTarget, DirectCollectionChangeRecord changeRecord, MergeManager mergeManager, AbstractSession session) INTERNAL: Merge changes by adding and removing from the change record to the target object, and its delegate object if instance of IndirectCollection. It will also reorder the collection if required. -
mergeIntoObject
public void mergeIntoObject(Object target, boolean isTargetUnInitialized, Object source, MergeManager mergeManager, AbstractSession targetSession) INTERNAL: Merge changes from the source to the target object.- Overrides:
mergeIntoObject
in classCollectionMapping
-
performDataModificationEvent
public void performDataModificationEvent(Object[] event, AbstractSession session) throws DatabaseException, DescriptorException INTERNAL: Perform the commit event. This is used in the uow to delay data modifications.- Overrides:
performDataModificationEvent
in classDatabaseMapping
- Throws:
DatabaseException
DescriptorException
-
postCalculateChanges
INTERNAL: Overridden by mappings that require additional processing of the change record after the record has been calculated.- Overrides:
postCalculateChanges
in classCollectionMapping
-
postInsert
INTERNAL: Insert the private owned object.- Overrides:
postInsert
in classCollectionMapping
- Throws:
DatabaseException
-
getFieldValue
INTERNAL: Convert the attribute value to a field value. Process any converter if defined. -
getObjectValue
INTERNAL: Convert the field value to an attribute value. Process any converter if defined. -
getFieldsForTranslationInAggregate
INTERNAL: Return source key fields for translation by an AggregateObjectMapping- Overrides:
getFieldsForTranslationInAggregate
in classForeignReferenceMapping
-
postUpdate
INTERNAL: Update private owned part.- Overrides:
postUpdate
in classDatabaseMapping
- Throws:
DatabaseException
-
postUpdateWithChangeSet
INTERNAL: Update private owned part.- Throws:
DatabaseException
-
postUpdateWithChangeSetListOrder
protected void postUpdateWithChangeSetListOrder(WriteObjectQuery writeQuery) throws DatabaseException INTERNAL: Update private owned part.- Throws:
DatabaseException
-
preDelete
INTERNAL: Delete private owned part. Which is a collection of objects from the reference table.- Overrides:
preDelete
in classDatabaseMapping
- Throws:
DatabaseException
-
prepareTranslationRow
protected void prepareTranslationRow(AbstractRecord translationRow, Object object, ClassDescriptor descriptor, AbstractSession session) INTERNAL: The translation row may require additional fields than the primary key if the mapping in not on the primary key.- Overrides:
prepareTranslationRow
in classCollectionMapping
-
initOrRebuildSelectQuery
protected void initOrRebuildSelectQuery()INTERNAL: Used by DirectMapMapping to rebuild select query. -
recordPrivateOwnedRemovals
INTERNAL: Overridden by mappings that require additional processing of the change record after the record has been calculated.- Overrides:
recordPrivateOwnedRemovals
in classCollectionMapping
-
remoteInitialization
INTERNAL: Once descriptors are serialized to the remote session. All its mappings and reference descriptors are traversed. Usually mappings are initialized and serialized reference descriptors are replaced with local descriptors if they already exist on the remote session.- Overrides:
remoteInitialization
in classForeignReferenceMapping
-
replaceValueHoldersIn
INTERNAL: replace the value holders in the specified reference object(s)- Overrides:
replaceValueHoldersIn
in classCollectionMapping
-
setAttributeClassification
PUBLIC: Some databases do not properly support all of the base data types. For these databases, the base data type must be explicitly specified in the mapping to tell EclipseLink to force the instance variable value to that data type.- Since:
- Java Persistence API 2.0 Migrated from AbstractDirectMapping
-
setAttributeClassificationName
INTERNAL: Set the name of the class for MW usage.- Since:
- Java Persistence API 2.0 Migrated from AbstractDirectMapping
-
setDeleteQuery
-
setDeleteSQLString
PUBLIC: Set the receiver's delete SQL string. This allows the user to override the SQL generated by TopLink, with there own SQL or procedure call. The arguments are translated from the fields of the source row, through replacing the field names marked by '#' with the values for those fields. This SQL is responsible for doing the deletion required by the mapping, such as deletion from join table for M-M. Example, 'delete from RESPONS where EMP_ID = #EMP_ID and DESCRIP = #DESCRIP'. -
setContainerPolicy
ADVANCED: Configure the mapping to use a container policy. The policy manages the access to the collection.- Specified by:
setContainerPolicy
in interfaceContainerMapping
- Overrides:
setContainerPolicy
in classCollectionMapping
-
setCustomDeleteQuery
PUBLIC: The default delete query for this mapping can be overridden by specifying the new query. This query is responsible for doing the deletion required by the mapping, such as deletion from join table for M-M. The query should delete a specific row from the DirectCollectionTable bases on the DirectField. -
setCustomDeleteAtIndexQuery
PUBLIC: The default delete by index query for this mapping can be overridden by specifying the new query. This query used (only in case listOrderField != null) to delete object with particular orderFieldValue. -
setCustomInsertQuery
PUBLIC: The default insert query for mapping can be overridden by specifying the new query. This query inserts the row into the direct table. -
setCustomUpdateAtIndexQuery
PUBLIC: The default delete by index query for this mapping can be overridden by specifying the new query. This query used (only in case listOrderField != null) to update orderFieldValue of object with particular orderFieldValue. -
setDirectField
PUBLIC: Set the direct field in the reference table. This is the field that the primitive data value is stored in. -
setDirectFieldClassification
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. -
setDirectFieldClassificationName
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. -
setDirectFieldName
PUBLIC: Set the direct field name in the reference table. This is the field that the primitive data value is stored in. -
setHasCustomDeleteQuery
protected void setHasCustomDeleteQuery(boolean bool) -
setHasCustomInsertQuery
protected void setHasCustomInsertQuery(boolean bool) -
setInsertQuery
-
setInsertSQLString
PUBLIC: Set the receiver's insert SQL string. This allows the user to override the SQL generated by TopLink, with there own SQL or procedure call. The arguments are translated from the fields of the source row, through replacing the field names marked by '#' with the values for those fields. This is used to insert an entry into the direct table.Example, 'insert into RESPONS (EMP_ID, RES_DESC) values (#EMP_ID, #RES_DESC)'.
-
setReferenceClass
INTERNAL: This cannot be used with direct collection mappings.- Overrides:
setReferenceClass
in classForeignReferenceMapping
-
setReferenceClassName
Description copied from class:ForeignReferenceMapping
INTERNAL: Used by MW.- Overrides:
setReferenceClassName
in classForeignReferenceMapping
-
setReferenceKeyFieldName
PUBLIC: Set the name of the reference key field. This is the foreign key field in the direct table referencing the primary key of the source object. This method is used if the reference key consists of only a single field. -
setReferenceKeyFieldNames
INTERNAL: Set the reference key field names associated with the mapping. These must be in-order with the sourceKeyFieldNames. -
setReferenceKeyFields
INTERNAL: Set the reference fields. -
setReferenceTable
INTERNAL: Set the reference table. -
setSelectionCriteria
PUBLIC: Sets the selection criteria to be used as a where clause to read reference objects. This criteria is automatically generated by the TopLink if not explicitly specified by the user.- Overrides:
setSelectionCriteria
in classForeignReferenceMapping
-
setReferenceTableName
PUBLIC: Set the reference table name. -
setSelectionQueryContainerPolicy
INTERNAL: Set the container policy on the selection query for this mapping.- Overrides:
setSelectionQueryContainerPolicy
in classCollectionMapping
-
setHistoryPolicy
PUBLIC: Support history on the reference table. -
setSessionName
PUBLIC: Set the name of the session to execute the mapping's queries under. This can be used by the session broker to override the default session to be used for the target class.- Overrides:
setSessionName
in classCollectionMapping
-
setSourceKeyFieldNames
INTERNAL: Set the source key field names associated with the mapping. These must be in-order with the referenceKeyFieldNames. -
setSourceKeyFields
INTERNAL: Set the source fields. -
collectQueryParameters
INTERNAL: This method is used to store the FK fields that can be cached that correspond to noncacheable mappings the FK field values will be used to re-issue the query when cloning the shared cache entity- Overrides:
collectQueryParameters
in classCollectionMapping
- Parameters:
cacheFields
- TODO
-
calculateDeferredChanges
INTERNAL: Used by AttributeLevelChangeTracking to update a changeRecord with calculated changes as apposed to detected changes. If an attribute can not be change tracked it's changes can be detected through this process.- Overrides:
calculateDeferredChanges
in classCollectionMapping
- Parameters:
changeRecord
- TODOsession
- TODO
-
simpleAddToCollectionChangeRecord
public void simpleAddToCollectionChangeRecord(Object referenceKey, Object objectToAdd, ObjectChangeSet changeSet, AbstractSession session) ADVANCED: This method is used to have an object add to a collection once the changeSet is applied The referenceKey parameter should only be used for direct Maps.- Overrides:
simpleAddToCollectionChangeRecord
in classCollectionMapping
-
simpleAddToCollectionChangeRecord
protected void simpleAddToCollectionChangeRecord(Object objectToAdd, Integer index, boolean isSet, ObjectChangeSet changeSet, AbstractSession session, boolean isChangeApplied) -
simpleRemoveFromCollectionChangeRecord
public void simpleRemoveFromCollectionChangeRecord(Object referenceKey, Object objectToRemove, ObjectChangeSet changeSet, AbstractSession session) ADVANCED: This method is used to have an object removed from a collection once the changeSet is applied The referenceKey parameter should only be used for direct Maps.- Overrides:
simpleRemoveFromCollectionChangeRecord
in classCollectionMapping
-
simpleRemoveFromCollectionChangeRecord
protected void simpleRemoveFromCollectionChangeRecord(Object objectToRemove, Integer index, boolean isSet, ObjectChangeSet changeSet, AbstractSession session, boolean isChangeApplied) -
updateChangeRecord
public void updateChangeRecord(Object clone, Object newValue, Object oldValue, ObjectChangeSet objectChangeSet, UnitOfWorkImpl uow) INTERNAL: Either create a new change record or update with the new value. This is used by attribute change tracking. Specifically in a collection mapping this will be called when the customer Set a new collection. In this case we will need to mark the change record with the new and the old versions of the collection. And mark the ObjectChangeSet with the attribute name then when the changes are calculated force a compare on the collections to determine changes.- Overrides:
updateChangeRecord
in classCollectionMapping
-
updateCollectionChangeRecord
public void updateCollectionChangeRecord(CollectionChangeEvent event, ObjectChangeSet changeSet, UnitOfWorkImpl uow) INTERNAL: Add or removes a new value and its change set to the collection change record based on the event passed in. This is used by attribute change tracking.- Overrides:
updateCollectionChangeRecord
in classCollectionMapping
-
useMapClass
PUBLIC: It is illegal to use a Map as the container of a DirectCollectionMapping. Only Collection containers are supported for DirectCollectionMappings.- Specified by:
useMapClass
in interfaceContainerMapping
- Overrides:
useMapClass
in classCollectionMapping
- See Also:
-
valueFromRow
public Object valueFromRow(AbstractRecord row, JoinedAttributeManager joinManager, ObjectBuildingQuery sourceQuery, CacheKey cacheKey, AbstractSession session, boolean isTargetProtected, Boolean[] wasCacheUsed) throws DatabaseException INTERNAL: Return the value of the reference attribute or a value holder. Check whether the mapping's attribute should be optimized through batch and joining. Overridden to support flashback/historical queries.- Overrides:
valueFromRow
in classForeignReferenceMapping
- Throws:
DatabaseException
-
verifyDelete
INTERNAL: Checks if object is deleted from the database or not.- Overrides:
verifyDelete
in classCollectionMapping
- Throws:
DatabaseException
-
isCandidateForPrivateOwnedRemoval
public boolean isCandidateForPrivateOwnedRemoval()INTERNAL: DirectCollectionMapping contents should not be considered for addition to the UnitOfWork private owned objects list for removal.- Overrides:
isCandidateForPrivateOwnedRemoval
in classDatabaseMapping
-
isCascadedLockingSupported
public boolean isCascadedLockingSupported()INTERNAL Return true if this mapping supports cascaded version optimistic locking.- Overrides:
isCascadedLockingSupported
in classDatabaseMapping
-