public class DirectMapMapping extends DirectCollectionMapping
Converter
,
ObjectTypeConverter
,
TypeConversionConverter
,
SerializedObjectConverter
,
Serialized FormModifier and Type | Field and Description |
---|---|
protected DatabaseField |
directKeyField
The direct key field name is converted and stored
|
protected Converter |
keyConverter
Allows user defined conversion between the object attribute value and the database value.
|
changeSetDeleteQuery, Delete, DeleteAll, directField, hasCustomDeleteQuery, hasCustomInsertQuery, Insert, insertQuery, referenceKeyFields, referenceTable, sourceKeyFields, valueConverter
containerPolicy, deleteAllQuery, hasCustomDeleteAllQuery, hasOrderBy
cascadeMerge, cascadePersist, cascadeRefresh, cascadeRemove, hasCustomSelectionQuery, indirectionPolicy, isPrivateOwned, referenceClass, referenceClassName, referenceDescriptor, relationshipPartner, relationshipPartnerAttributeName, selectionQuery, tempInitSession
attributeAccessor, descriptor, fields, isOptional, isReadOnly, isRemotelyInitialized, NO_FIELDS, NO_WEIGHT, primaryKeyMapping, properties, weight, WEIGHT_1
Constructor and Description |
---|
DirectMapMapping()
DirectMapCollectionMapping constructor
|
Modifier and Type | Method and Description |
---|---|
void |
addToCollectionChangeRecord(Object newKey,
Object newValue,
ObjectChangeSet objectChangeSet,
UnitOfWorkImpl uow)
INTERNAL:
Add a new value and its change set to the collection change record.
|
Object |
buildCloneForPartObject(Object attributeValue,
Object original,
Object clone,
UnitOfWorkImpl unitOfWork,
boolean isExisting)
INTERNAL:
Require for cloning, the part must be cloned.
|
protected Object |
buildKeyClone(Object element,
UnitOfWorkImpl unitOfWork,
boolean isExisting)
INTERNAL:
Clone the key, if necessary.
|
ChangeRecord |
compareForChange(Object clone,
Object backUp,
ObjectChangeSet owner,
AbstractSession session)
INTERNAL:
This method compares the changes between two direct collections.
|
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.
|
Object |
extractResultFromBatchQuery(DatabaseQuery query,
AbstractRecord databaseRow,
AbstractSession session,
AbstractRecord argumentRow)
INTERNAL:
Ovewrite super method
|
DatabaseField |
getDirectKeyField()
INTERNAL:
|
Class |
getKeyClass()
PUBLIC:
This is a helper method to get the object class from the key converter
if it is a TypeConversionConverter.
|
Converter |
getKeyConverter()
PUBLIC:
Return the converter on the mapping.
|
Class |
getValueClass()
PUBLIC:
This is a helper method to get the object class from the value converter
if it is a TypeConversionConverter.
|
void |
initialize(AbstractSession session)
INTERNAL:
Initialize and validate the mapping properties.
|
protected void |
initializeContainerPolicy(AbstractSession session)
set the key and value fields that are used to build the container from database rows
|
protected void |
initializeDeleteQuery(AbstractSession session) |
protected void |
initializeDirectKeyField(AbstractSession session)
The field name on the reference table is initialized and cached.
|
protected void |
initializeInsertQuery(AbstractSession session)
Initialize insert query.
|
protected void |
initializeSelectionStatement(AbstractSession session) |
boolean |
isDirectMapMapping()
INTERNAL:
Related mapping should implement this method to return true.
|
void |
mergeChangesIntoObject(Object target,
ChangeRecord changeRecord,
Object source,
MergeManager mergeManager)
INTERNAL:
Merge changes from the source to the target object.
|
void |
mergeIntoObject(Object target,
boolean isTargetUnInitialized,
Object source,
MergeManager mergeManager)
INTERNAL:
Merge changes from the source to the target object.
|
void |
postInsert(WriteObjectQuery query)
INTERNAL:
Insert the private owned object.
|
protected void |
postUpdateWithChangeSet(WriteObjectQuery writeQuery)
INTERNAL:
Update private owned part.
|
void |
removeFromCollectionChangeRecord(Object newKey,
Object newValue,
ObjectChangeSet objectChangeSet,
UnitOfWorkImpl uow)
INTERNAL:
Remove a value and its change set from the collection change record.
|
void |
setDirectKeyField(DatabaseField keyField)
INTERNAL:
|
void |
setDirectKeyFieldName(String fieldName)
PUBLIC:
Set the direct key field name in the reference table.
|
void |
setKeyClass(Class keyClass)
PUBLIC:
This is a helper method to set the key converter to a TypeConversionConverter.
|
void |
setKeyConverter(Converter keyConverter)
PUBLIC:
Set the converter on the mapping.
|
void |
setValueClass(Class valueClass)
PUBLIC:
This is a helper method to set the value converter to a TypeConversionConverter.
|
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.
|
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 the change record with the new value.
|
void |
useMapClass(Class concreteClass)
PUBLIC:
Configure the mapping to use an instance of the specified container class
to hold the target objects.
|
void |
useTransparentMap()
PUBLIC:
Configure the mapping to use an instance of the specified container class
to hold the target objects.
|
addReferenceKeyField, addReferenceKeyFieldName, buildCopy, buildElementClone, calculateDeferredChanges, cascadePerformRemoveIfRequired, cascadeRegisterNewIfRequired, clone, compareCollectionsForChange, extractKeyFromReferenceRow, extractPrimaryKeyFromRow, getDeleteQuery, getDirectField, getDirectFieldName, getInsertQuery, getReferenceClass, getReferenceClassName, getReferenceDescriptor, getReferenceKeyFieldNames, getReferenceKeyFields, getReferenceTable, getReferenceTableName, getReferenceTableQualifiedName, getRelationshipPartner, getSourceKeyFieldNames, getSourceKeyFields, getValueConverter, hasCustomDeleteQuery, hasCustomInsertQuery, initializeDeleteAllQuery, initializeDirectField, initializeReferenceDescriptor, initializeReferenceKeys, initializeReferenceTable, initializeSelectionCriteria, initializeSelectionQuery, initializeSourceKeys, initializeSourceKeysWithDefaults, isCascadedLockingSupported, isChangeTrackingSupported, isDirectCollectionMapping, isKeyForSourceSpecified, isPrivateOwned, isRelationalMapping, iterateOnElement, iterateOnRealAttributeValue, performDataModificationEvent, postUpdate, preDelete, prepareTranslationRow, setContainerPolicy, setCustomDeleteQuery, setCustomInsertQuery, setDeleteQuery, setDeleteSQLString, setDirectField, setDirectFieldClassification, setDirectFieldName, setHasCustomDeleteQuery, setHasCustomInsertQuery, setInsertQuery, setInsertSQLString, setReferenceClass, setReferenceClassName, setReferenceKeyFieldName, setReferenceKeyFieldNames, setReferenceKeyFields, setReferenceTable, setReferenceTableName, setSessionName, setSourceKeyFieldNames, setSourceKeyFields, setValueConverter, useCollectionClass, useMapClass, valueFromRow, verifyDelete
addAggregateOrderBy, addAscendingOrdering, addDescendingOrdering, addOrderBy, buildBackupCloneForPartObject, buildChangeRecord, cascadeMerge, compareObjectsAndWrite, compareObjectsWithoutPrivateOwned, compareObjectsWithPrivateOwned, getContainerPolicy, getDeleteAllQuery, getRealAttributeValueFromObject, getRealCollectionAttributeValueFromObject, hasCustomDeleteAllQuery, hasOrderBy, isCollectionMapping, objectAddedDuringUpdate, objectRemovedDuringUpdate, objectUnchangedDuringUpdate, objectUnchangedDuringUpdate, readPrivateOwnedForObject, setCustomDeleteAllQuery, setDeleteAllCall, setDeleteAllQuery, setDeleteAllSQLString, setHasCustomDeleteAllQuery, shouldUseValueFromRowWithJoin, useSortedSetClass, useTransparentCollection, useTransparentList, useTransparentMap, useTransparentSet, validateBeforeInitialization, valueFromRowInternalWithJoin
buildBackupClone, buildClone, buildCloneFromRow, createUnitOfWorkValueHolder, dontDoMerge, dontUseIndirection, getAttributeValueFromObject, getAttributeValueWithClonedValueHolders, getIndirectionPolicy, getJoinCriteria, getRelationshipPartnerAttributeName, getSelectionCriteria, getSelectionQuery, getTempSession, hasCustomSelectionQuery, isAttributeValueInstantiated, isCascadeMerge, isCascadePersist, isCascadeRefresh, isCascadeRemove, isForeignReferenceMapping, iterate, prepareHistoricalQuery, prepareNestedJoins, privateOwnedRelationship, setCascadeAll, setCascadeMerge, setCascadePersist, setCascadeRefresh, setCascadeRemove, setCustomSelectionQuery, setHasCustomSelectionQuery, setIndirectionPolicy, setIsPrivateOwned, setRealAttributeValueInObject, setReferenceDescriptor, setRelationshipPartner, setRelationshipPartnerAttributeName, setSelectionCall, setSelectionCriteria, setSelectionQuery, setSelectionSQLString, setTempSession, setUsesIndirection, shouldInitializeSelectionCriteria, shouldMergeCascadeParts, shouldMergeCascadeReference, shouldObjectModifyCascadeToParts, shouldObjectModifyCascadeToPartsForPreDelete, trimRowForJoin, trimRowForJoin, useBasicIndirection, usesIndirection, useWeavedIndirection, valueFromRowInternal
buildObjectJoinExpression, buildObjectJoinExpression, buildShallowOriginalFromRow, cloneFields, collectFields, extractNestedExpressions, getAttributeAccessor, getAttributeClassification, getAttributeName, getDescriptor, getField, getFieldClassification, getFields, getGetMethodName, getProperties, getProperty, getReferenceClassDescriptor, getSetMethodName, getWeight, hasConstraintDependency, hasDependency, hasInverseConstraintDependency, isAbstractCompositeCollectionMapping, isAbstractCompositeDirectCollectionMapping, isAbstractCompositeObjectMapping, isAbstractDirectMapping, isAggregateCollectionMapping, isAggregateMapping, isAggregateObjectMapping, isCloningRequired, isDatabaseMapping, isDirectToFieldMapping, isDirectToXMLTypeMapping, isEISMapping, isJoiningSupported, isManyToManyMapping, isNestedTableMapping, isObjectReferenceMapping, isObjectTypeMapping, isOneToManyMapping, isOneToOneMapping, isOptional, isPrimaryKeyMapping, isReadOnly, isReferenceMapping, isRemotelyInitialized, isSerializedObjectMapping, isStructureMapping, isTransformationMapping, isTypeConversionMapping, isUsingMethodAccess, isVariableOneToOneMapping, isWriteOnly, isXMLMapping, postDelete, postInitialize, preInitialize, preInsert, prepareCascadeLockingPolicy, preUpdate, readFromRowIntoObject, readFromRowIntoObject, readOnly, readWrite, rehashFieldDependancies, setAttributeAccessor, setAttributeName, setAttributeValueInObject, setDescriptor, setFields, setGetMethodName, setIsOptional, setIsPrimaryKeyMapping, setIsReadOnly, setProperties, setProperty, setSetMethodName, setWeight, toString, validateAfterInitialization, valueFromObject, valueFromRow, writeFromAttributeIntoRow, writeFromObjectIntoRow, writeFromObjectIntoRowForShallowDelete, writeFromObjectIntoRowForShallowInsert, writeFromObjectIntoRowForShallowInsertWithChangeRecord, writeFromObjectIntoRowForUpdate, writeFromObjectIntoRowForWhereClause, writeFromObjectIntoRowWithChangeRecord, writeInsertFieldsIntoRow, writeUpdateFieldsIntoRow
protected DatabaseField directKeyField
protected Converter keyConverter
public DirectMapMapping()
public Converter getKeyConverter()
public void setKeyConverter(Converter keyConverter)
public void addToCollectionChangeRecord(Object newKey, Object newValue, ObjectChangeSet objectChangeSet, UnitOfWorkImpl uow) throws DescriptorException
addToCollectionChangeRecord
in class DirectCollectionMapping
DescriptorException
public Object buildCloneForPartObject(Object attributeValue, Object original, Object clone, UnitOfWorkImpl unitOfWork, boolean isExisting)
buildCloneForPartObject
in class CollectionMapping
protected Object buildKeyClone(Object element, UnitOfWorkImpl unitOfWork, boolean isExisting)
public ChangeRecord compareForChange(Object clone, Object backUp, ObjectChangeSet owner, AbstractSession session)
compareForChange
in class DirectCollectionMapping
public boolean compareObjects(Object firstObject, Object secondObject, AbstractSession session)
compareObjects
in class DirectCollectionMapping
public void convertClassNamesToClasses(ClassLoader classLoader)
convertClassNamesToClasses
in class DirectCollectionMapping
classLoader
- public DatabaseField getDirectKeyField()
public void initialize(AbstractSession session) throws DescriptorException
initialize
in class DirectCollectionMapping
DescriptorException
protected void initializeContainerPolicy(AbstractSession session)
protected void initializeDeleteQuery(AbstractSession session)
initializeDeleteQuery
in class DirectCollectionMapping
protected void initializeDirectKeyField(AbstractSession session) throws DescriptorException
DescriptorException
protected void initializeInsertQuery(AbstractSession session)
initializeInsertQuery
in class DirectCollectionMapping
protected void initializeSelectionStatement(AbstractSession session)
initializeSelectionStatement
in class DirectCollectionMapping
public boolean isDirectMapMapping()
isDirectMapMapping
in class DatabaseMapping
public void mergeChangesIntoObject(Object target, ChangeRecord changeRecord, Object source, MergeManager mergeManager)
mergeChangesIntoObject
in class DirectCollectionMapping
public void mergeIntoObject(Object target, boolean isTargetUnInitialized, Object source, MergeManager mergeManager)
mergeIntoObject
in class DirectCollectionMapping
public void postInsert(WriteObjectQuery query) throws DatabaseException
postInsert
in class DirectCollectionMapping
DatabaseException
protected void postUpdateWithChangeSet(WriteObjectQuery writeQuery) throws DatabaseException
postUpdateWithChangeSet
in class DirectCollectionMapping
DatabaseException
public void removeFromCollectionChangeRecord(Object newKey, Object newValue, ObjectChangeSet objectChangeSet, UnitOfWorkImpl uow) throws DescriptorException
removeFromCollectionChangeRecord
in class DirectCollectionMapping
DescriptorException
public void setDirectKeyField(DatabaseField keyField)
public void setDirectKeyFieldName(String fieldName)
public void updateChangeRecord(Object clone, Object newValue, Object oldValue, ObjectChangeSet objectChangeSet, UnitOfWorkImpl uow) throws DescriptorException
updateChangeRecord
in class DirectCollectionMapping
DescriptorException
public void useMapClass(Class concreteClass)
The default container class is java.util.Hashtable.
The container class must implements (directly or indirectly) the Map interface.
Note: Do not use both useMapClass(Class concreteClass), useTransparentMap(). The last use of one of the two methods will overide the previous one.
useMapClass
in class CollectionMapping
public void useTransparentMap()
jdk1.2.x: The container class must implement (directly or indirectly) the Map interface.
jdk1.1.x: The container class must be a subclass of Hashtable.
Note: Do not use both useMapClass(Class concreteClass), useTransparentMap(). The last use of one of the two methods will overide the previous one.
public void setKeyClass(Class keyClass)
public Class getKeyClass()
public void setValueClass(Class valueClass)
public void simpleAddToCollectionChangeRecord(Object referenceKey, Object objectToAdd, ObjectChangeSet changeSet, AbstractSession session)
simpleAddToCollectionChangeRecord
in class DirectCollectionMapping
public void simpleRemoveFromCollectionChangeRecord(Object referenceKey, Object objectToRemove, ObjectChangeSet changeSet, AbstractSession session)
simpleRemoveFromCollectionChangeRecord
in class DirectCollectionMapping
public Class getValueClass()
public Object extractResultFromBatchQuery(DatabaseQuery query, AbstractRecord databaseRow, AbstractSession session, AbstractRecord argumentRow)
Copyright © 2024. All rights reserved.