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.
| Modifier and Type | Class and Description |
|---|---|
| protected static enum | OneToOneMapping.ShallowMode
Mode for writeFromObjectIntoRowInternal method |
| Modifier and Type | Field and Description |
|---|---|
| protected HashSet | insertableFields
Keep track of which fields are insertable and updatable. |
| protected boolean | isOneToOnePrimaryKeyRelationship
Defines if this mapping was built using primary key join columns. |
| protected boolean | isOneToOneRelationship
Define if this mapping is really for a OneToOne relationship. |
| public DatabaseTable | |
| protected RelationTableMechanism | mechanism
Mechanism holds relationTable and all fields and queries associated with it. |
| protected transient Expression | |
| protected static final String | |
| protected boolean | shouldVerifyDelete
These are used for non-unit of work modification to check if the value of the 1-1 was changed and a deletion is required. |
| protected transient List | sourceExpressionsToPostInitialize
Keep a reference to the source and target expressions to post initialize when building a selection criteria early. |
| protected Map | sourceToTargetKeyFields
Maps the source foreign/primary key fields to the target primary/foreign key fields. |
| protected transient List | |
| protected Map | targetToSourceKeyFields
Maps the target primary/foreign key fields to the source foreign/primary key fields. |
| protected HashSet |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | addAdditionalFieldsToQuery(ReadQuery selectionQuery, Expression baseExpression)
Implements org. |
| public void | addFieldsForMapKey(AbstractRecord joinRow)
Implements org. |
| public void | addForeignKeyField(DatabaseField sourceForeignKeyField, DatabaseField targetPrimaryKeyField)
Overrides org. |
| public void | addForeignKeyFieldName(String sourceForeignKeyFieldName, String targetPrimaryKeyFieldName)
PUBLIC: Define the foreign key relationship in the 1-1 mapping. |
| public void | addKeyToDeletedObjectsList(Object object, Map<K, V> deletedObjects)
Implements org. |
| public void | addTargetForeignKeyField(DatabaseField targetForeignKeyField, DatabaseField sourcePrimaryKeyField)
Overrides org. |
| public void | addTargetForeignKeyFieldName(String targetForeignKeyFieldName, String sourcePrimaryKeyFieldName)
PUBLIC: Define the target foreign key relationship in the 1-1 mapping. |
| protected Expression | buildBatchCriteria(ExpressionBuilder builder, ObjectLevelReadQuery query)
Overrides org. |
| public Object | buildElementClone(Object attributeValue, Object parent, CacheKey cacheKey, Integer refreshCascade, AbstractSession cloningSession, boolean isExisting, boolean isFromSharedCache)
Implements org. |
| public Expression | buildObjectJoinExpression(Expression
TODO expression, Object TODO value, AbstractSession TODO session)Overrides org. |
| public Expression | buildObjectJoinExpression(Expression
TODO expression, Expression TODO argument, AbstractSession TODO session)Overrides org. |
| public Expression | buildSelectionCriteria()
This method would allow customers to get the potential selection criteria for a mapping prior to initialization. |
| public Expression | buildSelectionCriteria(boolean useParameter, boolean usePreviousSelectionCriteria)
INTERNAL: Build the selection criteria for this mapping. |
| public ReadQuery | buildSelectionQueryForDirectCollectionKeyMapping(ContainerPolicy containerPolicy)
Implements org. |
| public void | buildShallowOriginalFromRow(AbstractRecord
TODO databaseRow, Object TODO original, JoinedAttributeManager TODO joinManager, ObjectBuildingQuery TODO query, AbstractSession TODO executionSession)Overrides org. |
| protected Object | checkCacheForBatchKey(AbstractRecord sourceRow, Object foreignKey, Map<K, V> batchObjects, ReadQuery batchQuery, ObjectLevelReadQuery originalQuery, AbstractSession session)
Overrides org. |
| public Object | clone()
Overrides org. Implements org. |
| protected Vector | collectFields()
Overrides org. |
| public void | collectQueryParameters(Set<DatabaseField>
TODO cacheFields)Overrides org. |
| public Object | createMapComponentFromJoinedRow(AbstractRecord dbRow, JoinedAttributeManager joinManager, ObjectBuildingQuery query, CacheKey parentCacheKey, AbstractSession session, boolean isTargetProtected)
Implements org. |
| public Object | createMapComponentFromRow(AbstractRecord dbRow, ObjectBuildingQuery query, CacheKey parentCacheKey, AbstractSession session, boolean isTargetProtected)
Implements org. |
| public List | createMapComponentsFromSerializableKeyInfo(Object[] keyInfo, AbstractSession session)
Implements org. |
| public QueryKey | createQueryKeyForMapKey()
Implements org. |
| public Object | createSerializableMapKeyInfo(Object key, AbstractSession session)
Implements org. |
| public Object | createStubbedMapComponentFromSerializableKeyInfo(Object keyInfo, AbstractSession session)
Implements org. |
| public void | deleteMapKey(Object objectDeleted, AbstractSession session)
Implements org. |
| protected void | executeBatchQuery(DatabaseQuery query, CacheKey parentCacheKey, Map<K, V> referenceObjectsByKey, AbstractSession session, AbstractRecord translationRow)
Overrides org. |
| public void | extendPessimisticLockScopeInSourceQuery(ObjectLevelReadQuery sourceQuery)
Overrides org. |
| protected void | extendPessimisticLockScopeInTargetQuery(ObjectLevelReadQuery targetQuery, ObjectBuildingQuery sourceQuery)
Overrides org. |
| protected Object | extractBatchKeyFromRow(AbstractRecord row, AbstractSession session)
Overrides org. |
| public Map | extractIdentityFieldsForQuery(Object object, AbstractSession session)
Implements org. |
| protected Object | extractKeyFromReferenceObject(Object object, AbstractSession session)
INTERNAL: Extract the key value from the reference object. |
| public Object | extractPrimaryKeysForReferenceObjectFromRow(AbstractRecord row)
Overrides org. |
| public Expression | getAdditionalSelectionCriteriaForMapKey()
Implements org. |
| public List | getAdditionalTablesForJoinQuery()
Implements org. |
| public List | getAllFieldsForMapKey()
Implements org. |
| protected ReadQuery | getExtendPessimisticLockScopeDedicatedQuery(AbstractSession session, short lockMode)
Overrides org. |
| public Class | getFieldClassification(DatabaseField fieldToClassify)
Overrides org. |
| public Collection | getFieldsForTranslationInAggregate()
Overrides org. |
| public Vector | |
| public Map | getForeignKeyFieldsForMapKey()
Implements org. |
| protected Map | getForeignKeysToPrimaryKeys()
Return the appropriate map that maps the "foreign keys" to the "primary keys". |
| public List | getIdentityFieldsForMapKey()
Implements org. |
| public Class | getMapKeyTargetType()
Implements org. |
| public ObjectLevelReadQuery | getNestedJoinQuery(JoinedAttributeManager joinManager, ObjectLevelReadQuery query, AbstractSession session)
Implements org. |
| public List | getOrderByNormalizedExpressions(Expression base)
Overrides org. |
| public 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. |
| protected ClassDescriptor | getPrimaryKeyDescriptor()
Return the descriptor for whichever side of the relation has the "primary key". |
| 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. |
| public DatabaseTable | |
| 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). |
| public Vector | getSourceToTargetKeyFieldAssociations()
INTERNAL: Return a collection of the source to target field value associations. |
| public Map | |
| public Map | |
| public Object | getTargetVersionOfSourceObject(Object object, Object parent, MergeManager mergeManager, AbstractSession targetSession)
Implements org. |
| public boolean | |
| public boolean | hasRelationTableMechanism()
Overrides org. |
| public void | initialize(AbstractSession session)
Overrides org. |
| protected void | initializeForeignKeys(AbstractSession session)
INTERNAL: The foreign keys primary keys are stored as database fields in the map. |
| protected void | initializeForeignKeysWithDefaults(AbstractSession session)
INTERNAL: The foreign keys primary keys are stored as database fields in the map. |
| protected void | initializePrivateOwnedCriteria()
INTERNAL: Selection criteria is created with source foreign keys and target keys. |
| public boolean | isCascadedLockingSupported()
Overrides org. |
| public boolean | isJoiningSupported()
Overrides org. |
| public boolean | isOneToOneMapping()
Overrides org. |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | isRelationalMapping()
Overrides org. |
| public void | iterateOnMapKey(DescriptorIterator iterator, Object element)
Implements org. |
| public void | performDataModificationEvent(Object[] event, AbstractSession session)
Overrides org. |
| public void | postInitializeMapKey(MappedKeyMapContainerPolicy policy)
Implements org. |
| public void | postInitializeSourceAndTargetExpressions()
Overrides org. |
| public void | postInsert(WriteObjectQuery query)
Overrides org. |
| protected void | postPrepareNestedBatchQuery(ReadQuery batchQuery, ObjectLevelReadQuery query)
Overrides org. |
| public void | postUpdate(WriteObjectQuery query)
Overrides org. |
| public void | preDelete(DeleteObjectQuery query)
Overrides org. |
| public void | preinitializeMapKey(DatabaseTable table)
Implements org. |
| public void | prepareCascadeLockingPolicy()
Overrides org. |
| protected Object | readPrivateOwnedForObject(ObjectLevelModifyQuery modifyQuery)
Overrides org. |
| public void | rehashFieldDependancies(AbstractSession session)
Overrides org. |
| public boolean | requiresDataModificationEventsForMapKey()
Implements org. |
| public void | setForeignKeyFieldName(String sourceForeignKeyFieldName)
PUBLIC: Define the foreign key relationship in the 1-1 mapping. |
| public void | setForeignKeyFieldNames(Vector<E> fieldNames)
PUBLIC: Return the foreign key field names associated with the mapping. |
| public void | setIsOneToOnePrimaryKeyRelationship(boolean isOneToOnePrimaryKeyRelationship)
Set if this mapping is defined using primary key join columns. |
| public void | setIsOneToOneRelationship(boolean isOneToOneRelationship)
Define if this mapping is really for a OneToOne relationship. |
| protected void | setPrivateOwnedCriteria(Expression expression)
INTERNAL: Private owned criteria is used to verify the deletion of the target. |
| public void | |
| public void | setRelationTableMechanism(RelationTableMechanism mechanism)
PUBLIC: Set RelationTableMechanism into the mapping, that allows to configure the mapping to use relation table (just like ManyToManyMapping). |
| 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. |
| public void | setSourceToTargetKeyFieldAssociations(Vector<E> sourceToTargetKeyFieldAssociations)
INTERNAL: Set a collection of the source to target field associations. |
| public void | setSourceToTargetKeyFields(Map<DatabaseField, DatabaseField> sourceToTargetKeyFields)
INTERNAL: Set the source keys to target keys fields association. |
| public void | setTargetForeignKeyFieldName(String targetForeignKeyFieldName)
PUBLIC: Define the target foreign key relationship in the 1-1 mapping. |
| public void | setTargetToSourceKeyFields(Map<DatabaseField, DatabaseField> targetToSourceKeyFields)
INTERNAL: Set the target keys to source keys fields association. |
| public boolean | shouldVerifyDelete()
PUBLIC: Verify delete is used during delete and update outside of a unit of work only. |
| protected boolean | shouldWriteField(DatabaseField field, DatabaseMapping.
INTERNAL: By default returns true. |
| public Object | unwrapKey(Object key, AbstractSession session)
Implements org. |
| protected void | updateInsertableAndUpdatableFields(DatabaseField field)
INTERNAL: Add the field to the updatable and/or insertable list. |
| public Object | valueFromObject(Object
TODO object, DatabaseField TODO field, AbstractSession TODO session)Overrides org. |
| protected Object | valueFromRowInternal(AbstractRecord row, JoinedAttributeManager joinManager, ObjectBuildingQuery sourceQuery, AbstractSession executionSession, boolean
indicates whether sopObject stored in the row should be used to extract the value (and fields/values stored in the row ignored). shouldUseSopObject)Overrides org. |
| protected Object | valueFromRowInternalWithJoin(AbstractRecord row, JoinedAttributeManager joinManager, ObjectBuildingQuery sourceQuery, CacheKey parentCacheKey, AbstractSession executionSession, boolean isTargetProtected)
Overrides org. |
| public Object | wrapKey(Object key, AbstractSession session)
Implements org. |
| public void | writeFromAttributeIntoRow(Object attribute, AbstractRecord row, AbstractSession session)
Overrides org. |
| public void | writeFromObjectIntoRow(Object object, AbstractRecord databaseRow, AbstractSession session, DatabaseMapping.
Overrides org. |
| public void | writeFromObjectIntoRowForShallowInsert(Object object, AbstractRecord databaseRow, AbstractSession session)
Overrides org. |
| public void | writeFromObjectIntoRowForShallowInsertWithChangeRecord(ChangeRecord ChangeRecord, AbstractRecord databaseRow, AbstractSession session)
INTERNAL:
This row is built for shallow insert which happens in case of bidirectional inserts.
|
| public void | writeFromObjectIntoRowForUpdateAfterShallowInsert(Object object, AbstractRecord databaseRow, AbstractSession session, DatabaseTable table)
Overrides org. |
| public void | writeFromObjectIntoRowForUpdateBeforeShallowDelete(Object object, AbstractRecord databaseRow, AbstractSession session, DatabaseTable table)
Overrides org. |
| protected void | writeFromObjectIntoRowInternal(Object object, AbstractRecord databaseRow, AbstractSession session, OneToOneMapping.
INTERNAL: Get a value from the object and set that in the respective field of the row. |
| public void | writeFromObjectIntoRowWithChangeRecord(ChangeRecord changeRecord, AbstractRecord databaseRow, AbstractSession session, DatabaseMapping.
Overrides org. |
| public void | writeInsertFieldsIntoRow(AbstractRecord databaseRow, AbstractSession session)
Overrides org. |