org.eclipse.persistence.mappings
Class OneToOneMapping

java.lang.Object
  extended by org.eclipse.persistence.mappings.DatabaseMapping
      extended by org.eclipse.persistence.mappings.ForeignReferenceMapping
          extended by org.eclipse.persistence.mappings.ObjectReferenceMapping
              extended by org.eclipse.persistence.mappings.OneToOneMapping
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, MapComponentMapping, MapKeyMapping, RelationalMapping

public class OneToOneMapping
extends ObjectReferenceMapping
implements RelationalMapping, MapKeyMapping

Purpose: One to one mappings are used to represent a pointer references between two java objects. This mappings is usually represented by a single pointer (stored in an instance variable) between the source and target objects. In the relational database tables, these mappings are normally implemented using foreign keys.

Since:
TOPLink/Java 1.0
Author:
Sati
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.eclipse.persistence.mappings.DatabaseMapping
DatabaseMapping.WriteType
 
Field Summary
 org.eclipse.persistence.internal.helper.DatabaseTable keyTableForMapKey
           
 
Fields inherited from class org.eclipse.persistence.mappings.ForeignReferenceMapping
INNER_JOIN, NONE, OUTER_JOIN
 
Constructor Summary
OneToOneMapping()
          PUBLIC: Default constructor.
 
Method Summary
 void addAdditionalFieldsToQuery(ReadQuery selectionQuery, Expression baseExpression)
          INTERNAL: Used when initializing queries for mappings that use a Map Called when the selection query is being initialized to add the fields for the map key to the query
 void addFieldsForMapKey(org.eclipse.persistence.internal.sessions.AbstractRecord joinRow)
          INTERNAL: Used when initializing queries for mappings that use a Map Called when the insert query is being initialized to ensure the fields for the map key are in the insert query
 void addForeignKeyField(org.eclipse.persistence.internal.helper.DatabaseField sourceForeignKeyField, org.eclipse.persistence.internal.helper.DatabaseField targetPrimaryKeyField)
          PUBLIC: Define the foreign key relationship in the 1-1 mapping.
 void addForeignKeyFieldName(java.lang.String sourceForeignKeyFieldName, java.lang.String targetPrimaryKeyFieldName)
          PUBLIC: Define the foreign key relationship in the 1-1 mapping.
 void addKeyToDeletedObjectsList(java.lang.Object object, java.util.Map deletedObjects)
          INTERNAL: For mappings used as MapKeys in MappedKeyContainerPolicy.
 void addTargetForeignKeyField(org.eclipse.persistence.internal.helper.DatabaseField targetForeignKeyField, org.eclipse.persistence.internal.helper.DatabaseField sourcePrimaryKeyField)
          PUBLIC: Define the target foreign key relationship in the 1-1 mapping.
 void addTargetForeignKeyFieldName(java.lang.String targetForeignKeyFieldName, java.lang.String sourcePrimaryKeyFieldName)
          PUBLIC: Define the target foreign key relationship in the 1-1 mapping.
 java.lang.Object buildElementClone(java.lang.Object attributeValue, java.lang.Object parent, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl unitOfWork, boolean isExisting)
          Build a clone of the given element in a unitOfWork
 Expression buildObjectJoinExpression(Expression expression, Expression argument, org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: Used to allow object level comparisons.
 Expression buildObjectJoinExpression(Expression expression, java.lang.Object value, org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: Used to allow object level comparisons.
 Expression buildSelectionCriteria()
          This method would allow customers to get the potential selection criteria for a mapping prior to initialization.
 Expression buildSelectionCriteria(boolean useParameter, boolean usePreviousSelectionCriteria)
          INTERNAL: Build the selection criteria for this mapping.
 ReadQuery buildSelectionQueryForDirectCollectionKeyMapping(org.eclipse.persistence.internal.queries.ContainerPolicy containerPolicy)
          INTERNAL: Certain key mappings favor different types of selection query.
 void buildShallowOriginalFromRow(org.eclipse.persistence.internal.sessions.AbstractRecord databaseRow, java.lang.Object original, org.eclipse.persistence.internal.queries.JoinedAttributeManager joinManager, ObjectBuildingQuery query, org.eclipse.persistence.internal.sessions.AbstractSession executionSession)
          INTERNAL: Builds a shallow original object.
 java.lang.Object clone()
          INTERNAL: This methods clones all the fields and ensures that each collection refers to the same clones.
 java.lang.Object createMapComponentFromJoinedRow(org.eclipse.persistence.internal.sessions.AbstractRecord dbRow, org.eclipse.persistence.internal.queries.JoinedAttributeManager joinManager, ObjectBuildingQuery query, org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL Called when a DatabaseMapping is used to map the key in a collection.
 java.lang.Object createMapComponentFromRow(org.eclipse.persistence.internal.sessions.AbstractRecord dbRow, ObjectBuildingQuery query, org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL Called when a DatabaseMapping is used to map the key in a collection.
 QueryKey createQueryKeyForMapKey()
          INTERNAL: Create a query key that links to the map key
 void deleteMapKey(java.lang.Object objectDeleted, org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: For mappings used as MapKeys in MappedKeyContainerPolicy, Delete the passed object if necessary.
 void extendPessimisticLockScopeInSourceQuery(ObjectLevelReadQuery sourceQuery)
          INTERNAL: Called only if both shouldExtendPessimisticLockScope and shouldExtendPessimisticLockScopeInSourceQuery are true.
 java.util.Map extractIdentityFieldsForQuery(java.lang.Object object, org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: Extract the fields for the Map key from the object to use in a query
 java.util.Vector extractPrimaryKeysForReferenceObjectFromRow(org.eclipse.persistence.internal.sessions.AbstractRecord row)
          INTERNAL: Return the primary key for the reference object (i.e.
 java.lang.Object extractResultFromBatchQuery(DatabaseQuery query, org.eclipse.persistence.internal.sessions.AbstractRecord databaseRow, org.eclipse.persistence.internal.sessions.AbstractSession session, org.eclipse.persistence.internal.sessions.AbstractRecord argumentRow)
          INTERNAL: Extract the value from the batch optimized query.
 Expression getAdditionalSelectionCriteriaForMapKey()
          INTERNAL: Return the selection criteria necessary to select the target object when this mapping is a map key.
 java.util.List<org.eclipse.persistence.internal.helper.DatabaseTable> getAdditionalTablesForJoinQuery()
          INTERNAL: Return any tables that will be required when this mapping is used as part of a join query
 java.util.List<org.eclipse.persistence.internal.helper.DatabaseField> getAllFieldsForMapKey()
          INTERNAL: Get all the fields for the map key
 java.lang.Class getFieldClassification(org.eclipse.persistence.internal.helper.DatabaseField fieldToClassify)
          INTERNAL: Return the classification for the field contained in the mapping.
 java.util.Vector getForeignKeyFieldNames()
          PUBLIC: Return the foreign key field names associated with the mapping.
 java.util.Map<org.eclipse.persistence.internal.helper.DatabaseField,org.eclipse.persistence.internal.helper.DatabaseField> getForeignKeyFieldsForMapKey()
          INTERNAL: Return a Map of any foreign keys defined within the the MapKey
 java.util.List<org.eclipse.persistence.internal.helper.DatabaseField> getIdentityFieldsForMapKey()
          INTERNAL: Return the fields that make up the identity of the mapped object.
 java.lang.Class getMapKeyTargetType()
          INTERNAL: Return the class this key mapping maps or the descriptor for it
 ObjectLevelReadQuery getNestedJoinQuery(org.eclipse.persistence.internal.queries.JoinedAttributeManager joinManager, ObjectLevelReadQuery query, org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: Return the query that is used when this mapping is part of a joined relationship This method is used when this mapping is used to map the key in a Map
 java.util.Vector getOrderedForeignKeyFields()
          INTERNAL: Return a vector of the foreign key fields in the same order as the corresponding primary key fields are in their descriptor.
 Expression getPrivateOwnedCriteria()
          INTERNAL: The private owned criteria is only used outside of the unit of work to compare the previous value of the reference.
 org.eclipse.persistence.internal.helper.DatabaseTable getRelationTable()
          PUBLIC: Return RelationTable.
 RelationTableMechanism getRelationTableMechanism()
          PUBLIC: Returns RelationTableMechanism that may be owned by the mapping, that allows to configure the mapping to use relation table (just like ManyToManyMapping).
 java.util.Vector getSourceToTargetKeyFieldAssociations()
          INTERNAL: Return a collection of the source to target field value associations.
 java.util.Map<org.eclipse.persistence.internal.helper.DatabaseField,org.eclipse.persistence.internal.helper.DatabaseField> getSourceToTargetKeyFields()
          INTERNAL: Returns the source keys to target keys fields association.
 java.util.Map<org.eclipse.persistence.internal.helper.DatabaseField,org.eclipse.persistence.internal.helper.DatabaseField> getTargetToSourceKeyFields()
          INTERNAL: Returns the target keys to source keys fields association.
 java.lang.Object getTargetVersionOfSourceObject(java.lang.Object object, java.lang.Object parent, org.eclipse.persistence.internal.sessions.MergeManager mergeManager)
          INTERNAL: If required, get the targetVersion of the source object from the merge manager Used with MapKeyContainerPolicy to abstract getting the target version of a source key
 boolean hasRelationTable()
          PUBLIC: Indicates whether the mapping has RelationTable.
 boolean hasRelationTableMechanism()
          PUBLIC: Indicates whether the mapping has RelationTableMechanism.
 void initialize(org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: Initialize the mapping.
 boolean isCascadedLockingSupported()
          INTERNAL Return true if this mapping supports cascaded version optimistic locking.
 boolean isDefinedAsManyToOneMapping()
          INTERNAL: Return whether this mapping was originally defined as a ManyToOne
 boolean isJoiningSupported()
          INTERNAL: Return if this mapping support joining.
 boolean isOneToOneMapping()
          INTERNAL:
 boolean isOwned()
          INTERNAL:
 boolean isRelationalMapping()
          INTERNAL:
 void iterateOnMapKey(org.eclipse.persistence.internal.descriptors.DescriptorIterator iterator, java.lang.Object element)
          INTERNAL: Called when iterating through descriptors to handle iteration on this mapping when it is used as a MapKey
 void performDataModificationEvent(java.lang.Object[] event, org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: Perform the commit event.
 void postInitializeMapValueSelectionQuery(ReadQuery selectionQuery, org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: Allow the selectionQuery to be modified when this MapComponentMapping is used as the value in a Map
 void postInsert(WriteObjectQuery query)
          INTERNAL: Insert into relation table.
 void postUpdate(WriteObjectQuery query)
          INTERNAL: Update the relation table with the entries related to this mapping.
 void preDelete(DeleteObjectQuery query)
          INTERNAL: Delete privately owned parts
 void preinitializeMapKey(org.eclipse.persistence.internal.helper.DatabaseTable table)
          INTERNAL: Making any mapping changes necessary to use a the mapping as a map key prior to initializing the mapping
 void prepareCascadeLockingPolicy()
          INTERNAL: Prepare a cascade locking policy.
 void rehashFieldDependancies(org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: Rehash any map based on fields.
 boolean requiresDataModificationEventsForMapKey()
          INTERNAL: Return whether this mapping requires extra queries to update the rows if it is used as a key in a map.
 void setDefinedAsManyToOneMapping(boolean isDefinedAsManyToOneMapping)
          INTERNAL: Set whether this mapping was originally defined as a ManyToOne
 void setForeignKeyFieldName(java.lang.String sourceForeignKeyFieldName)
          PUBLIC: Define the foreign key relationship in the 1-1 mapping.
 void setForeignKeyFieldNames(java.util.Vector fieldNames)
          PUBLIC: Return the foreign key field names associated with the mapping.
 void setRelationTableMechanism(RelationTableMechanism mechanism)
          PUBLIC: Set RelationTableMechanism into the mapping, that allows to configure the mapping to use relation table (just like ManyToManyMapping).
 void setShouldVerifyDelete(boolean shouldVerifyDelete)
          PUBLIC: Verify delete is used during delete and update on private 1:1's outside of a unit of work only.
 void setSourceToTargetKeyFieldAssociations(java.util.Vector sourceToTargetKeyFieldAssociations)
          INTERNAL: Set a collection of the source to target field associations.
 void setSourceToTargetKeyFields(java.util.Map<org.eclipse.persistence.internal.helper.DatabaseField,org.eclipse.persistence.internal.helper.DatabaseField> sourceToTargetKeyFields)
          INTERNAL: Set the source keys to target keys fields association.
 void setTargetForeignKeyFieldName(java.lang.String targetForeignKeyFieldName)
          PUBLIC: Define the target foreign key relationship in the 1-1 mapping.
 void setTargetToSourceKeyFields(java.util.Map<org.eclipse.persistence.internal.helper.DatabaseField,org.eclipse.persistence.internal.helper.DatabaseField> targetToSourceKeyFields)
          INTERNAL: Set the target keys to source keys fields association.
 boolean shouldVerifyDelete()
          PUBLIC: Verify delete is used during delete and update outside of a unit of work only.
 java.lang.Object unwrapKey(java.lang.Object key, org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: Allow the key mapping to unwrap the object
 java.lang.Object valueFromObject(java.lang.Object object, org.eclipse.persistence.internal.helper.DatabaseField field, org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: Get a value from the object and set that in the respective field of the row.
 java.lang.Object wrapKey(java.lang.Object key, org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: Allow the key mapping to wrap the object
 void writeFromAttributeIntoRow(java.lang.Object attribute, org.eclipse.persistence.internal.sessions.AbstractRecord row, org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: A subclass should implement this method if it wants different behavior.
 void writeFromObjectIntoRow(java.lang.Object object, org.eclipse.persistence.internal.sessions.AbstractRecord databaseRow, org.eclipse.persistence.internal.sessions.AbstractSession session, DatabaseMapping.WriteType writeType)
          INTERNAL: Get a value from the object and set that in the respective field of the row.
 void writeFromObjectIntoRowForShallowInsert(java.lang.Object object, org.eclipse.persistence.internal.sessions.AbstractRecord databaseRow, org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: This row is built for shallow insert which happens in case of bidirectional inserts.
 void writeFromObjectIntoRowForShallowInsertWithChangeRecord(org.eclipse.persistence.internal.sessions.ChangeRecord ChangeRecord, org.eclipse.persistence.internal.sessions.AbstractRecord databaseRow, org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: This row is built for shallow insert which happens in case of bidirectional inserts.
 void writeFromObjectIntoRowWithChangeRecord(org.eclipse.persistence.internal.sessions.ChangeRecord changeRecord, org.eclipse.persistence.internal.sessions.AbstractRecord databaseRow, org.eclipse.persistence.internal.sessions.AbstractSession session, DatabaseMapping.WriteType writeType)
          INTERNAL: Get a value from the object and set that in the respective field of the row.
 void writeInsertFieldsIntoRow(org.eclipse.persistence.internal.sessions.AbstractRecord databaseRow, org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: Write fields needed for insert into the template for with null values.
 
Methods inherited from class org.eclipse.persistence.mappings.ObjectReferenceMapping
buildBackupCloneForPartObject, buildChangeRecord, buildCloneForPartObject, buildCopy, buildExpression, buildReferencesPKList, buildTargetInterfaces, cascadeDiscoverAndPersistUnregisteredNewObjects, cascadeDiscoverAndPersistUnregisteredNewObjects, cascadePerformRemoveIfRequired, cascadePerformRemoveIfRequired, cascadePerformRemovePrivateOwnedObjectFromChangeSetIfRequired, cascadeRegisterNewIfRequired, cascadeRegisterNewIfRequired, compareForChange, createUnitOfWorkValueHolder, extractPrimaryKeyRowForSourceObject, extractPrimaryKeysForReferenceObject, extractPrimaryKeysFromRealReferenceObject, fixRealObjectReferences, getDescriptorForTarget, getForeignKeyFields, getRealAttributeValueFromAttribute, hasConstraintDependency, internalBuildChangeRecord, isChangeTrackingSupported, isForeignKeyRelationship, isObjectReferenceMapping, iterateOnRealAttributeValue, mergeChangesIntoObject, mergeIntoObject, postCalculateChanges, postDelete, preInitialize, preInsert, preUpdate, recordPrivateOwnedRemovals, setIsForeignKeyRelationship, setNewValueInChangeRecord, updateChangeRecord, useProxyIndirection, useProxyIndirection, useProxyIndirection, valueFromPKList, verifyDelete, writeFromObjectIntoRowForUpdate, writeFromObjectIntoRowForWhereClause
 
Methods inherited from class org.eclipse.persistence.mappings.ForeignReferenceMapping
buildBackupClone, buildClone, buildCloneFromRow, compareObjects, convertClassNamesToClasses, dontUseBatchReading, dontUseIndirection, fixObjectReferences, getAttributeValueFromObject, getAttributeValueWithClonedValueHolders, getIndirectionPolicy, getJoinCriteria, getJoinFetch, getObjectCorrespondingTo, getReferenceClass, getReferenceClassName, getReferenceDescriptor, getRelationshipPartner, getRelationshipPartnerAttributeName, getSelectionCriteria, getSelectionQuery, getValueFromRemoteValueHolder, hasCustomSelectionQuery, instantiateAttribute, isAttributeValueInstantiated, isCascadeDetach, isCascadeMerge, isCascadePersist, isCascadeRefresh, isCascadeRemove, isForeignReferenceMapping, isInnerJoinFetched, isJoinFetched, isLazy, isLockableMapping, isOuterJoinFetched, isPrivateOwned, iterate, mergeRemoteValueHolder, prepareNestedBatchQuery, prepareNestedJoins, privateOwnedRelationship, remoteInitialization, replaceValueHoldersIn, requiresTransientWeavedFields, setCascadeAll, setCascadeDetach, setCascadeMerge, setCascadePersist, setCascadeRefresh, setCascadeRemove, setCustomSelectionQuery, setForceInitializationOfSelectionCriteria, setIndirectionPolicy, setIsPrivateOwned, setJoinFetch, setRealAttributeValueInObject, setReferenceClass, setReferenceClassName, setRelationshipPartner, setRelationshipPartnerAttributeName, setRequiresTransientWeavedFields, setSelectionCall, setSelectionCriteria, setSelectionSQLString, setShouldExtendPessimisticLockScope, setUsesBatchReading, setUsesIndirection, shouldExtendPessimisticLockScope, shouldExtendPessimisticLockScopeInDedicatedQuery, shouldExtendPessimisticLockScopeInSourceQuery, shouldExtendPessimisticLockScopeInTargetQuery, shouldMergeCascadeParts, shouldUseBatchReading, trimRowForJoin, trimRowForJoin, useBasicIndirection, useBatchReading, useContainerIndirection, useInnerJoinFetch, useOuterJoinFetch, usesIndirection, useWeavedIndirection, validateBeforeInitialization, valueFromRow
 
Methods inherited from class org.eclipse.persistence.mappings.DatabaseMapping
calculateDeferredChanges, cascadeMerge, derivesId, earlyPreDelete, getAttributeAccessor, getAttributeClassification, getAttributeName, getContainerPolicy, getDerivedIdMapping, getDescriptor, getField, getFields, getGetMethodName, getMapsIdValue, getProperties, getProperty, getRealAttributeValueFromObject, getRealCollectionAttributeValueFromObject, getSelectFields, getSelectTables, getSetMethodName, getWeight, hasDependency, hasInverseConstraintDependency, hasMapsIdValue, isAbstractCompositeCollectionMapping, isAbstractCompositeDirectCollectionMapping, isAbstractCompositeObjectMapping, isAbstractDirectMapping, isAggregateCollectionMapping, isAggregateMapping, isAggregateObjectMapping, isCandidateForPrivateOwnedRemoval, isCloningRequired, isCollectionMapping, isDatabaseMapping, isDirectCollectionMapping, isDirectMapMapping, isDirectToFieldMapping, isDirectToXMLTypeMapping, isEISMapping, isJPAId, isManyToManyMapping, isMapKeyMapping, isNestedTableMapping, isOneToManyMapping, isOptional, isPrimaryKeyMapping, isReadOnly, isReferenceMapping, isStructureMapping, isTransformationMapping, isUnidirectionalOneToManyMapping, isUsingMethodAccess, isVariableOneToOneMapping, isWriteOnly, isXMLMapping, postCalculateChangesOnDeleted, postInitialize, readFromResultSetIntoObject, readFromRowIntoObject, readOnly, readWrite, setAttributeAccessor, setAttributeName, setAttributeValueInObject, setChangeListener, setDerivedIdMapping, setDerivesId, setDescriptor, setGetMethodName, setIsJPAId, setIsLazy, setIsMapKeyMapping, setIsOptional, setIsPrimaryKeyMapping, setIsReadOnly, setMapsIdValue, setProperties, setProperty, setSetMethodName, setWeight, simpleAddToCollectionChangeRecord, simpleRemoveFromCollectionChangeRecord, toString, updateCollectionChangeRecord, validateAfterInitialization, valueFromResultSet, valueFromRow, writeUpdateFieldsIntoRow
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.persistence.mappings.foundation.MapKeyMapping
cascadeDiscoverAndPersistUnregisteredNewObjects, cascadePerformRemoveIfRequired, cascadeRegisterNewIfRequired, getReferenceDescriptor
 

Field Detail

keyTableForMapKey

public org.eclipse.persistence.internal.helper.DatabaseTable keyTableForMapKey
Constructor Detail

OneToOneMapping

public OneToOneMapping()
PUBLIC: Default constructor.

Method Detail

isRelationalMapping

public boolean isRelationalMapping()
INTERNAL:

Overrides:
isRelationalMapping in class DatabaseMapping

addAdditionalFieldsToQuery

public void addAdditionalFieldsToQuery(ReadQuery selectionQuery,
                                       Expression baseExpression)
INTERNAL: Used when initializing queries for mappings that use a Map Called when the selection query is being initialized to add the fields for the map key to the query

Specified by:
addAdditionalFieldsToQuery in interface MapKeyMapping

addFieldsForMapKey

public void addFieldsForMapKey(org.eclipse.persistence.internal.sessions.AbstractRecord joinRow)
INTERNAL: Used when initializing queries for mappings that use a Map Called when the insert query is being initialized to ensure the fields for the map key are in the insert query

Specified by:
addFieldsForMapKey in interface MapKeyMapping

addForeignKeyField

public void addForeignKeyField(org.eclipse.persistence.internal.helper.DatabaseField sourceForeignKeyField,
                               org.eclipse.persistence.internal.helper.DatabaseField targetPrimaryKeyField)
PUBLIC: Define the foreign key relationship in the 1-1 mapping. This method is used for composite foreign key relationships, that is the source object's table has multiple foreign key fields to the target object's primary key fields. Both the source foreign key field and the target foreign key field must be specified. When a foreign key is specified TopLink will automatically populate the value for that field from the target object when the object is written to the database. If the foreign key is also mapped through a direct-to-field then the direct-to-field must be set read-only.


addForeignKeyFieldName

public void addForeignKeyFieldName(java.lang.String sourceForeignKeyFieldName,
                                   java.lang.String targetPrimaryKeyFieldName)
PUBLIC: Define the foreign key relationship in the 1-1 mapping. This method is used for composite foreign key relationships, that is the source object's table has multiple foreign key fields to the target object's primary key fields. Both the source foreign key field name and the target foreign key field name must be specified. When a foreign key is specified TopLink will automatically populate the value for that field from the target object when the object is written to the database. If the foreign key is also mapped through a direct-to-field then the direct-to-field must be set read-only.


addTargetForeignKeyField

public void addTargetForeignKeyField(org.eclipse.persistence.internal.helper.DatabaseField targetForeignKeyField,
                                     org.eclipse.persistence.internal.helper.DatabaseField sourcePrimaryKeyField)
PUBLIC: Define the target foreign key relationship in the 1-1 mapping. This method is used for composite target foreign key relationships, that is the target object's table has multiple foreign key fields to the source object's primary key fields. Both the target foreign key field and the source primary key field must be specified. The distinction between a foreign key and target foreign key is that the 1-1 mapping will not populate the target foreign key value when written (because it is in the target table). Normally 1-1's are through foreign keys but in bi-directional 1-1's the back reference will be a target foreign key. In obscure composite legacy data models a 1-1 may consist of a foreign key part and a target foreign key part, in this case both method will be called with the correct parts.


addTargetForeignKeyFieldName

public void addTargetForeignKeyFieldName(java.lang.String targetForeignKeyFieldName,
                                         java.lang.String sourcePrimaryKeyFieldName)
PUBLIC: Define the target foreign key relationship in the 1-1 mapping. This method is used for composite target foreign key relationships, that is the target object's table has multiple foreign key fields to the source object's primary key fields. Both the target foreign key field name and the source primary key field name must be specified. The distinction between a foreign key and target foreign key is that the 1-1 mapping will not populate the target foreign key value when written (because it is in the target table). Normally 1-1's are through foreign keys but in bi-directional 1-1's the back reference will be a target foreign key. In obscure composite legacy data models a 1-1 may consist of a foreign key part and a target foreign key part, in this case both method will be called with the correct parts.


addKeyToDeletedObjectsList

public void addKeyToDeletedObjectsList(java.lang.Object object,
                                       java.util.Map deletedObjects)
INTERNAL: For mappings used as MapKeys in MappedKeyContainerPolicy. Add the target of this mapping to the deleted objects list if necessary This method is used for removal of private owned relationships

Specified by:
addKeyToDeletedObjectsList in interface MapKeyMapping
Parameters:
object -
manager -

buildElementClone

public java.lang.Object buildElementClone(java.lang.Object attributeValue,
                                          java.lang.Object parent,
                                          org.eclipse.persistence.internal.sessions.UnitOfWorkImpl unitOfWork,
                                          boolean isExisting)
Build a clone of the given element in a unitOfWork

Specified by:
buildElementClone in interface MapKeyMapping
Parameters:
element -
unitOfWork -
isExisting -
Returns:

buildObjectJoinExpression

public Expression buildObjectJoinExpression(Expression expression,
                                            java.lang.Object value,
                                            org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Used to allow object level comparisons.

Overrides:
buildObjectJoinExpression in class DatabaseMapping

buildObjectJoinExpression

public Expression buildObjectJoinExpression(Expression expression,
                                            Expression argument,
                                            org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Used to allow object level comparisons.

Overrides:
buildObjectJoinExpression in class DatabaseMapping

buildSelectionQueryForDirectCollectionKeyMapping

public ReadQuery buildSelectionQueryForDirectCollectionKeyMapping(org.eclipse.persistence.internal.queries.ContainerPolicy containerPolicy)
INTERNAL: Certain key mappings favor different types of selection query. Return the appropriate type of selectionQuery

Specified by:
buildSelectionQueryForDirectCollectionKeyMapping in interface MapKeyMapping
Returns:

clone

public java.lang.Object clone()
INTERNAL: This methods clones all the fields and ensures that each collection refers to the same clones.

Overrides:
clone in class ForeignReferenceMapping

createMapComponentFromRow

public java.lang.Object createMapComponentFromRow(org.eclipse.persistence.internal.sessions.AbstractRecord dbRow,
                                                  ObjectBuildingQuery query,
                                                  org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL Called when a DatabaseMapping is used to map the key in a collection. Returns the key.

Specified by:
createMapComponentFromRow in interface MapComponentMapping

createMapComponentFromJoinedRow

public java.lang.Object createMapComponentFromJoinedRow(org.eclipse.persistence.internal.sessions.AbstractRecord dbRow,
                                                        org.eclipse.persistence.internal.queries.JoinedAttributeManager joinManager,
                                                        ObjectBuildingQuery query,
                                                        org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL Called when a DatabaseMapping is used to map the key in a collection. Returns the key.

Specified by:
createMapComponentFromJoinedRow in interface MapKeyMapping

createQueryKeyForMapKey

public QueryKey createQueryKeyForMapKey()
INTERNAL: Create a query key that links to the map key

Specified by:
createQueryKeyForMapKey in interface MapKeyMapping
Returns:

deleteMapKey

public void deleteMapKey(java.lang.Object objectDeleted,
                         org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: For mappings used as MapKeys in MappedKeyContainerPolicy, Delete the passed object if necessary. This method is used for removal of private owned relationships

Specified by:
deleteMapKey in interface MapKeyMapping
Parameters:
objectDeleted -
session -

extendPessimisticLockScopeInSourceQuery

public void extendPessimisticLockScopeInSourceQuery(ObjectLevelReadQuery sourceQuery)
INTERNAL: Called only if both shouldExtendPessimisticLockScope and shouldExtendPessimisticLockScopeInSourceQuery are true. Adds fields to be locked to the where clause of the source query. Note that the sourceQuery must be ObjectLevelReadQuery so that it has ExpressionBuilder. This method must be implemented in subclasses that allow setting shouldExtendPessimisticLockScopeInSourceQuery to true.

Overrides:
extendPessimisticLockScopeInSourceQuery in class ForeignReferenceMapping

extractIdentityFieldsForQuery

public java.util.Map extractIdentityFieldsForQuery(java.lang.Object object,
                                                   org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Extract the fields for the Map key from the object to use in a query

Specified by:
extractIdentityFieldsForQuery in interface MapKeyMapping
Returns:

extractPrimaryKeysForReferenceObjectFromRow

public java.util.Vector extractPrimaryKeysForReferenceObjectFromRow(org.eclipse.persistence.internal.sessions.AbstractRecord row)
INTERNAL: Return the primary key for the reference object (i.e. the object object referenced by domainObject and specified by mapping). This key will be used by a RemoteValueHolder.

Overrides:
extractPrimaryKeysForReferenceObjectFromRow in class ObjectReferenceMapping

extractResultFromBatchQuery

public java.lang.Object extractResultFromBatchQuery(DatabaseQuery query,
                                                    org.eclipse.persistence.internal.sessions.AbstractRecord databaseRow,
                                                    org.eclipse.persistence.internal.sessions.AbstractSession session,
                                                    org.eclipse.persistence.internal.sessions.AbstractRecord argumentRow)
INTERNAL: Extract the value from the batch optimized query.

Overrides:
extractResultFromBatchQuery in class ForeignReferenceMapping

getAdditionalSelectionCriteriaForMapKey

public Expression getAdditionalSelectionCriteriaForMapKey()
INTERNAL: Return the selection criteria necessary to select the target object when this mapping is a map key.

Specified by:
getAdditionalSelectionCriteriaForMapKey in interface MapKeyMapping
Returns:

getAdditionalTablesForJoinQuery

public java.util.List<org.eclipse.persistence.internal.helper.DatabaseTable> getAdditionalTablesForJoinQuery()
INTERNAL: Return any tables that will be required when this mapping is used as part of a join query

Specified by:
getAdditionalTablesForJoinQuery in interface MapKeyMapping
Returns:

getFieldClassification

public java.lang.Class getFieldClassification(org.eclipse.persistence.internal.helper.DatabaseField fieldToClassify)
                                       throws DescriptorException
INTERNAL: Return the classification for the field contained in the mapping. This is used to convert the row value to a consistent java value.

Overrides:
getFieldClassification in class DatabaseMapping
Throws:
DescriptorException

getForeignKeyFieldNames

public java.util.Vector getForeignKeyFieldNames()
PUBLIC: Return the foreign key field names associated with the mapping. These are only the source fields that are writable.


getForeignKeyFieldsForMapKey

public java.util.Map<org.eclipse.persistence.internal.helper.DatabaseField,org.eclipse.persistence.internal.helper.DatabaseField> getForeignKeyFieldsForMapKey()
INTERNAL: Return a Map of any foreign keys defined within the the MapKey

Specified by:
getForeignKeyFieldsForMapKey in interface MapKeyMapping
Returns:

getIdentityFieldsForMapKey

public java.util.List<org.eclipse.persistence.internal.helper.DatabaseField> getIdentityFieldsForMapKey()
INTERNAL: Return the fields that make up the identity of the mapped object. For mappings with a primary key, it will be the set of fields in the primary key. For mappings without a primary key it will likely be all the fields

Specified by:
getIdentityFieldsForMapKey in interface MapKeyMapping
Returns:

getNestedJoinQuery

public ObjectLevelReadQuery getNestedJoinQuery(org.eclipse.persistence.internal.queries.JoinedAttributeManager joinManager,
                                               ObjectLevelReadQuery query,
                                               org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Return the query that is used when this mapping is part of a joined relationship This method is used when this mapping is used to map the key in a Map

Specified by:
getNestedJoinQuery in interface MapKeyMapping
Returns:

getAllFieldsForMapKey

public java.util.List<org.eclipse.persistence.internal.helper.DatabaseField> getAllFieldsForMapKey()
INTERNAL: Get all the fields for the map key

Specified by:
getAllFieldsForMapKey in interface MapKeyMapping

getOrderedForeignKeyFields

public java.util.Vector getOrderedForeignKeyFields()
INTERNAL: Return a vector of the foreign key fields in the same order as the corresponding primary key fields are in their descriptor.


getPrivateOwnedCriteria

public Expression getPrivateOwnedCriteria()
INTERNAL: The private owned criteria is only used outside of the unit of work to compare the previous value of the reference.


getSourceToTargetKeyFieldAssociations

public java.util.Vector getSourceToTargetKeyFieldAssociations()
INTERNAL: Return a collection of the source to target field value associations.


getSourceToTargetKeyFields

public java.util.Map<org.eclipse.persistence.internal.helper.DatabaseField,org.eclipse.persistence.internal.helper.DatabaseField> getSourceToTargetKeyFields()
INTERNAL: Returns the source keys to target keys fields association.


getTargetToSourceKeyFields

public java.util.Map<org.eclipse.persistence.internal.helper.DatabaseField,org.eclipse.persistence.internal.helper.DatabaseField> getTargetToSourceKeyFields()
INTERNAL: Returns the target keys to source keys fields association.


getTargetVersionOfSourceObject

public java.lang.Object getTargetVersionOfSourceObject(java.lang.Object object,
                                                       java.lang.Object parent,
                                                       org.eclipse.persistence.internal.sessions.MergeManager mergeManager)
INTERNAL: If required, get the targetVersion of the source object from the merge manager Used with MapKeyContainerPolicy to abstract getting the target version of a source key

Specified by:
getTargetVersionOfSourceObject in interface MapKeyMapping
Returns:

getMapKeyTargetType

public java.lang.Class getMapKeyTargetType()
INTERNAL: Return the class this key mapping maps or the descriptor for it

Specified by:
getMapKeyTargetType in interface MapKeyMapping
Returns:

initialize

public void initialize(org.eclipse.persistence.internal.sessions.AbstractSession session)
                throws DescriptorException
INTERNAL: Initialize the mapping.

Overrides:
initialize in class ForeignReferenceMapping
Throws:
DescriptorException

preinitializeMapKey

public void preinitializeMapKey(org.eclipse.persistence.internal.helper.DatabaseTable table)
                         throws DescriptorException
INTERNAL: Making any mapping changes necessary to use a the mapping as a map key prior to initializing the mapping

Specified by:
preinitializeMapKey in interface MapKeyMapping
Throws:
DescriptorException

postInitializeMapValueSelectionQuery

public void postInitializeMapValueSelectionQuery(ReadQuery selectionQuery,
                                                 org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Allow the selectionQuery to be modified when this MapComponentMapping is used as the value in a Map


prepareCascadeLockingPolicy

public void prepareCascadeLockingPolicy()
INTERNAL: Prepare a cascade locking policy.

Overrides:
prepareCascadeLockingPolicy in class DatabaseMapping

buildSelectionCriteria

public Expression buildSelectionCriteria()
This method would allow customers to get the potential selection criteria for a mapping prior to initialization. This would allow them to more easily create an amendment method that would amend the SQL for the join.


buildSelectionCriteria

public Expression buildSelectionCriteria(boolean useParameter,
                                         boolean usePreviousSelectionCriteria)
INTERNAL: Build the selection criteria for this mapping. Allows several variations. Either a parameter can be used for the join or simply the database field The existing selection criteria can be built upon or a whole new criteria can be built.

Parameters:
useParameter -
usePreviousSelectionCriteria -
Returns:

buildShallowOriginalFromRow

public void buildShallowOriginalFromRow(org.eclipse.persistence.internal.sessions.AbstractRecord databaseRow,
                                        java.lang.Object original,
                                        org.eclipse.persistence.internal.queries.JoinedAttributeManager joinManager,
                                        ObjectBuildingQuery query,
                                        org.eclipse.persistence.internal.sessions.AbstractSession executionSession)
INTERNAL: Builds a shallow original object. Only direct attributes and primary keys are populated. In this way the minimum original required for instantiating a working copy clone can be built without placing it in the shared cache (no concern over cycles).

Overrides:
buildShallowOriginalFromRow in class DatabaseMapping

isOneToOneMapping

public boolean isOneToOneMapping()
INTERNAL:

Overrides:
isOneToOneMapping in class DatabaseMapping

isOwned

public boolean isOwned()
INTERNAL:

Overrides:
isOwned in class DatabaseMapping

rehashFieldDependancies

public void rehashFieldDependancies(org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Rehash any map based on fields. This is used to clone descriptors for aggregates, which hammer field names, it is probably better not to hammer the field name and this should be refactored.

Overrides:
rehashFieldDependancies in class DatabaseMapping

requiresDataModificationEventsForMapKey

public boolean requiresDataModificationEventsForMapKey()
INTERNAL: Return whether this mapping requires extra queries to update the rows if it is used as a key in a map. This will typically be true if there are any parts to this mapping that are not read-only.

Specified by:
requiresDataModificationEventsForMapKey in interface MapKeyMapping

setDefinedAsManyToOneMapping

public void setDefinedAsManyToOneMapping(boolean isDefinedAsManyToOneMapping)
INTERNAL: Set whether this mapping was originally defined as a ManyToOne

Parameters:
isDefinedAsManyToOneMapping -

setForeignKeyFieldName

public void setForeignKeyFieldName(java.lang.String sourceForeignKeyFieldName)
PUBLIC: Define the foreign key relationship in the 1-1 mapping. This method is used for singleton foreign key relationships only, that is the source object's table has a foreign key field to the target object's primary key field. Only the source foreign key field name is specified. When a foreign key is specified TopLink will automatically populate the value for that field from the target object when the object is written to the database. If the foreign key is also mapped through a direct-to-field then the direct-to-field must be set read-only.


setForeignKeyFieldNames

public void setForeignKeyFieldNames(java.util.Vector fieldNames)
PUBLIC: Return the foreign key field names associated with the mapping. These are only the source fields that are writable.


setShouldVerifyDelete

public void setShouldVerifyDelete(boolean shouldVerifyDelete)
PUBLIC: Verify delete is used during delete and update on private 1:1's outside of a unit of work only. It checks for the previous value of the target object through joining the source and target tables. By default it is always done, but may be disabled for performance on distributed database reasons. In the unit of work the previous value is obtained from the backup-clone so it is never used.


setSourceToTargetKeyFieldAssociations

public void setSourceToTargetKeyFieldAssociations(java.util.Vector sourceToTargetKeyFieldAssociations)
INTERNAL: Set a collection of the source to target field associations.


setSourceToTargetKeyFields

public void setSourceToTargetKeyFields(java.util.Map<org.eclipse.persistence.internal.helper.DatabaseField,org.eclipse.persistence.internal.helper.DatabaseField> sourceToTargetKeyFields)
INTERNAL: Set the source keys to target keys fields association.


setTargetForeignKeyFieldName

public void setTargetForeignKeyFieldName(java.lang.String targetForeignKeyFieldName)
PUBLIC: Define the target foreign key relationship in the 1-1 mapping. This method is used for singleton target foreign key relationships only, that is the target object's table has a foreign key field to the source object's primary key field. The target foreign key field name is specified. The distinction between a foreign key and target foreign key is that the 1-1 mapping will not populate the target foreign key value when written (because it is in the target table). Normally 1-1's are through foreign keys but in bi-directional 1-1's the back reference will be a target foreign key.


setTargetToSourceKeyFields

public void setTargetToSourceKeyFields(java.util.Map<org.eclipse.persistence.internal.helper.DatabaseField,org.eclipse.persistence.internal.helper.DatabaseField> targetToSourceKeyFields)
INTERNAL: Set the target keys to source keys fields association.


shouldVerifyDelete

public boolean shouldVerifyDelete()
PUBLIC: Verify delete is used during delete and update outside of a unit of work only. It checks for the previous value of the target object through joining the source and target tables.


isCascadedLockingSupported

public boolean isCascadedLockingSupported()
INTERNAL Return true if this mapping supports cascaded version optimistic locking.

Overrides:
isCascadedLockingSupported in class DatabaseMapping

isDefinedAsManyToOneMapping

public boolean isDefinedAsManyToOneMapping()
INTERNAL: Return whether this mapping was originally defined as a ManyToOne

Returns:

isJoiningSupported

public boolean isJoiningSupported()
INTERNAL: Return if this mapping support joining.

Overrides:
isJoiningSupported in class ForeignReferenceMapping

iterateOnMapKey

public void iterateOnMapKey(org.eclipse.persistence.internal.descriptors.DescriptorIterator iterator,
                            java.lang.Object element)
INTERNAL: Called when iterating through descriptors to handle iteration on this mapping when it is used as a MapKey

Specified by:
iterateOnMapKey in interface MapKeyMapping
Parameters:
iterator -
element -

unwrapKey

public java.lang.Object unwrapKey(java.lang.Object key,
                                  org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Allow the key mapping to unwrap the object

Specified by:
unwrapKey in interface MapKeyMapping
Parameters:
key -
session -
Returns:

wrapKey

public java.lang.Object wrapKey(java.lang.Object key,
                                org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Allow the key mapping to wrap the object

Specified by:
wrapKey in interface MapKeyMapping
Parameters:
key -
session -
Returns:

writeFromAttributeIntoRow

public void writeFromAttributeIntoRow(java.lang.Object attribute,
                                      org.eclipse.persistence.internal.sessions.AbstractRecord row,
                                      org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: A subclass should implement this method if it wants different behavior. Write the foreign key values from the attribute to the row.

Overrides:
writeFromAttributeIntoRow in class DatabaseMapping

valueFromObject

public java.lang.Object valueFromObject(java.lang.Object object,
                                        org.eclipse.persistence.internal.helper.DatabaseField field,
                                        org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Get a value from the object and set that in the respective field of the row.

Overrides:
valueFromObject in class DatabaseMapping

writeFromObjectIntoRow

public void writeFromObjectIntoRow(java.lang.Object object,
                                   org.eclipse.persistence.internal.sessions.AbstractRecord databaseRow,
                                   org.eclipse.persistence.internal.sessions.AbstractSession session,
                                   DatabaseMapping.WriteType writeType)
INTERNAL: Get a value from the object and set that in the respective field of the row.

Overrides:
writeFromObjectIntoRow in class DatabaseMapping

writeFromObjectIntoRowForShallowInsert

public void writeFromObjectIntoRowForShallowInsert(java.lang.Object object,
                                                   org.eclipse.persistence.internal.sessions.AbstractRecord databaseRow,
                                                   org.eclipse.persistence.internal.sessions.AbstractSession session)
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.

Overrides:
writeFromObjectIntoRowForShallowInsert in class DatabaseMapping

writeFromObjectIntoRowWithChangeRecord

public void writeFromObjectIntoRowWithChangeRecord(org.eclipse.persistence.internal.sessions.ChangeRecord changeRecord,
                                                   org.eclipse.persistence.internal.sessions.AbstractRecord databaseRow,
                                                   org.eclipse.persistence.internal.sessions.AbstractSession session,
                                                   DatabaseMapping.WriteType writeType)
INTERNAL: Get a value from the object and set that in the respective field of the row. Validation preventing primary key updates is implemented here.

Overrides:
writeFromObjectIntoRowWithChangeRecord in class DatabaseMapping

writeFromObjectIntoRowForShallowInsertWithChangeRecord

public void writeFromObjectIntoRowForShallowInsertWithChangeRecord(org.eclipse.persistence.internal.sessions.ChangeRecord ChangeRecord,
                                                                   org.eclipse.persistence.internal.sessions.AbstractRecord databaseRow,
                                                                   org.eclipse.persistence.internal.sessions.AbstractSession session)
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.

Overrides:
writeFromObjectIntoRowForShallowInsertWithChangeRecord in class DatabaseMapping

writeInsertFieldsIntoRow

public void writeInsertFieldsIntoRow(org.eclipse.persistence.internal.sessions.AbstractRecord databaseRow,
                                     org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Write fields needed for insert into the template for with null values.

Overrides:
writeInsertFieldsIntoRow in class DatabaseMapping

hasRelationTableMechanism

public boolean hasRelationTableMechanism()
PUBLIC: Indicates whether the mapping has RelationTableMechanism.


hasRelationTable

public boolean hasRelationTable()
PUBLIC: Indicates whether the mapping has RelationTable.


getRelationTableMechanism

public RelationTableMechanism getRelationTableMechanism()
PUBLIC: Returns RelationTableMechanism that may be owned by the mapping, that allows to configure the mapping to use relation table (just like ManyToManyMapping). By default its null, should be created and set into the mapping before use.


setRelationTableMechanism

public void setRelationTableMechanism(RelationTableMechanism mechanism)
PUBLIC: Set RelationTableMechanism into the mapping, that allows to configure the mapping to use relation table (just like ManyToManyMapping).


getRelationTable

public org.eclipse.persistence.internal.helper.DatabaseTable getRelationTable()
PUBLIC: Return RelationTable.


preDelete

public void preDelete(DeleteObjectQuery query)
               throws DatabaseException,
                      OptimisticLockException
INTERNAL: Delete privately owned parts

Overrides:
preDelete in class ObjectReferenceMapping
Throws:
DatabaseException
OptimisticLockException

postInsert

public void postInsert(WriteObjectQuery query)
                throws DatabaseException
INTERNAL: Insert into relation table. This follows following steps.

- Extract primary key and its value from the source object.

- Extract target key and its value from the target object.

- Construct a insert statement with above fields and values for relation table.

- execute the statement.

Overrides:
postInsert in class ObjectReferenceMapping
Throws:
DatabaseException

postUpdate

public void postUpdate(WriteObjectQuery query)
                throws DatabaseException
INTERNAL: Update the relation table with the entries related to this mapping. Delete entries removed, insert entries added. If private also insert/delete/update target objects.

Overrides:
postUpdate in class ObjectReferenceMapping
Throws:
DatabaseException

performDataModificationEvent

public void performDataModificationEvent(java.lang.Object[] event,
                                         org.eclipse.persistence.internal.sessions.AbstractSession session)
                                  throws DatabaseException,
                                         DescriptorException
INTERNAL: Perform the commit event. This is used in the uow to delay data modifications.

Overrides:
performDataModificationEvent in class DatabaseMapping
Throws:
DatabaseException
DescriptorException