|
EclipseLink 1.1.1_ 1.1.1.v20090430-r4097 API Reference | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.persistence.mappings.DatabaseMapping org.eclipse.persistence.mappings.ForeignReferenceMapping org.eclipse.persistence.mappings.CollectionMapping org.eclipse.persistence.mappings.OneToManyMapping
public class OneToManyMapping
Purpose: This mapping is used to represent the typical RDBMS relationship between a single source object and collection of target objects; where, on the database, the target objects have references (foreign keys) to the source object.
Field Summary | |
---|---|
protected java.util.Vector<org.eclipse.persistence.internal.helper.DatabaseField> |
sourceKeyFields
The (typically primary) source key fields that are referenced by the targetForeignKeyFields. |
protected java.util.Map<org.eclipse.persistence.internal.helper.DatabaseField,org.eclipse.persistence.internal.helper.DatabaseField> |
sourceKeysToTargetForeignKeys
This maps the (primary) source key fields to the corresponding target foreign key fields. |
protected java.util.Vector<org.eclipse.persistence.internal.helper.DatabaseField> |
targetForeignKeyFields
The target foreign key fields that reference the sourceKeyFields. |
protected java.util.Map<org.eclipse.persistence.internal.helper.DatabaseField,org.eclipse.persistence.internal.helper.DatabaseField> |
targetForeignKeysToSourceKeys
This maps the target foreign key fields to the corresponding (primary) source key fields. |
Fields inherited from class org.eclipse.persistence.mappings.CollectionMapping |
---|
containerPolicy, deleteAllQuery, hasCustomDeleteAllQuery, hasOrderBy |
Fields inherited from class org.eclipse.persistence.mappings.ForeignReferenceMapping |
---|
cascadeMerge, cascadePersist, cascadeRefresh, cascadeRemove, forceInitializationOfSelectionCriteria, hasCustomSelectionQuery, indirectionPolicy, INNER_JOIN, isPrivateOwned, joinFetch, NONE, OUTER_JOIN, referenceClass, referenceClassName, referenceDescriptor, relationshipPartner, relationshipPartnerAttributeName, requiresTransientWeavedFields, selectionQuery, tempInitSession, usesBatchReading |
Fields inherited from class org.eclipse.persistence.mappings.DatabaseMapping |
---|
attributeAccessor, attributeName, descriptor, fields, isLazy, isOptional, isPrimaryKeyMapping, isReadOnly, isRemotelyInitialized, NO_FIELDS, NO_WEIGHT, properties, weight, WEIGHT_1 |
Constructor Summary | |
---|---|
OneToManyMapping()
PUBLIC: Default constructor. |
Method Summary | |
---|---|
void |
addTargetForeignKeyField(org.eclipse.persistence.internal.helper.DatabaseField targetForeignKeyField,
org.eclipse.persistence.internal.helper.DatabaseField sourceKeyField)
INTERNAL: Add the associated fields to the appropriate collections. |
void |
addTargetForeignKeyFieldName(java.lang.String targetForeignKeyFieldName,
java.lang.String sourceKeyFieldName)
PUBLIC: Define the target foreign key relationship in the one-to-many mapping. |
protected Expression |
buildDefaultSelectionCriteria()
The selection criteria are created with target foreign keys and source "primary" keys. |
Expression |
buildSelectionCriteria()
This method would allow customers to get the potential selection criteria for a mapping prior to initialization. |
java.lang.Object |
clone()
INTERNAL: Clone the appropriate attributes. |
protected void |
deleteAll(DeleteObjectQuery query)
Delete all the reference objects with a single query. |
protected void |
deleteReferenceObjectsLeftOnDatabase(DeleteObjectQuery query)
This method will make sure that all the records privately owned by this mapping are actually removed. |
protected java.util.Hashtable |
executeBatchQuery(DatabaseQuery query,
org.eclipse.persistence.internal.sessions.AbstractSession session,
org.eclipse.persistence.internal.sessions.AbstractRecord row)
We need to execute the batch query and store the results in a hash table keyed by the (primary) keys of the source objects. |
protected java.util.Vector |
extractForeignKeyFromReferenceObject(java.lang.Object object,
org.eclipse.persistence.internal.sessions.AbstractSession session)
Extract the foreign key value from the reference object. |
protected java.util.Vector |
extractKeyFromRow(org.eclipse.persistence.internal.sessions.AbstractRecord row,
org.eclipse.persistence.internal.sessions.AbstractSession session)
Extract the key field values from the specified row. |
java.lang.Object |
extractResultFromBatchQuery(DatabaseQuery query,
org.eclipse.persistence.internal.sessions.AbstractRecord row,
org.eclipse.persistence.internal.sessions.AbstractSession session,
org.eclipse.persistence.internal.sessions.AbstractRecord argumentRow)
INTERNAL: Extract the value from the batch optimized query. |
java.util.Vector |
getSourceKeyFieldNames()
PUBLIC: Return the source key field names associated with the mapping. |
java.util.Vector<org.eclipse.persistence.internal.helper.DatabaseField> |
getSourceKeyFields()
INTERNAL: Return the source key fields. |
java.util.Map<org.eclipse.persistence.internal.helper.DatabaseField,org.eclipse.persistence.internal.helper.DatabaseField> |
getSourceKeysToTargetForeignKeys()
INTERNAL: Return the source/target key fields. |
java.util.Vector |
getTargetForeignKeyFieldNames()
INTERNAL: Return the target foreign key field names associated with the mapping. |
java.util.Vector<org.eclipse.persistence.internal.helper.DatabaseField> |
getTargetForeignKeyFields()
INTERNAL: Return the target foreign key fields. |
java.util.Map<org.eclipse.persistence.internal.helper.DatabaseField,org.eclipse.persistence.internal.helper.DatabaseField> |
getTargetForeignKeysToSourceKeys()
INTERNAL: Return the target/source key fields. |
java.util.Map |
getTargetForeignKeyToSourceKeys()
INTERNAL: Maintain for backward compatibility. |
boolean |
hasInverseConstraintDependency()
INTERNAL: Return whether the mapping has any inverse constraint dependencies, such as foreign keys and join tables. |
void |
initialize(org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Initialize the mapping. |
protected void |
initializeDeleteAllQuery()
Initialize the delete all query. |
protected void |
initializeTargetForeignKeysToSourceKeys()
Verify, munge, and hash the target foreign keys and source keys. |
boolean |
isCascadedLockingSupported()
INTERNAL Return true if this mapping supports cascaded version optimistic locking. |
boolean |
isJoiningSupported()
INTERNAL: Return if this mapping support joining. |
boolean |
isOneToManyMapping()
INTERNAL: |
boolean |
isRelationalMapping()
INTERNAL: |
protected boolean |
isSourceKeySpecified()
Return whether the source key is specified. |
void |
postInsert(WriteObjectQuery query)
INTERNAL: Insert the reference objects. |
void |
postUpdate(WriteObjectQuery query)
INTERNAL: Update the reference objects. |
void |
preDelete(DeleteObjectQuery query)
INTERNAL: Delete the reference objects. |
void |
prepareCascadeLockingPolicy()
Prepare a cascade locking policy. |
void |
setDeleteAllSQLString(java.lang.String sqlString)
PUBLIC: Set the SQL string used by the mapping to delete the target objects. |
void |
setSourceKeyFieldNames(java.util.Vector fieldNames)
INTERNAL: Set the source key field names associated with the mapping. |
void |
setSourceKeyFields(java.util.Vector<org.eclipse.persistence.internal.helper.DatabaseField> sourceKeyFields)
INTERNAL: Set the source key fields. |
void |
setTargetForeignKeyFieldName(java.lang.String targetForeignKeyFieldName)
PUBLIC: Define the target foreign key relationship in the one-to-many mapping. |
void |
setTargetForeignKeyFieldNames(java.lang.String[] targetForeignKeyFieldNames,
java.lang.String[] sourceKeyFieldNames)
PUBLIC: Define the target foreign key relationship in the one-to-many mapping. |
void |
setTargetForeignKeyFieldNames(java.util.Vector fieldNames)
INTERNAL: Set the target key field names associated with the mapping. |
void |
setTargetForeignKeyFields(java.util.Vector<org.eclipse.persistence.internal.helper.DatabaseField> targetForeignKeyFields)
INTERNAL: Set the target fields. |
protected void |
setTargetForeignKeysToSourceKeys(java.util.Map<org.eclipse.persistence.internal.helper.DatabaseField,org.eclipse.persistence.internal.helper.DatabaseField> targetForeignKeysToSourceKeys)
INTERNAL: Set the target fields. |
protected boolean |
shouldObjectModifyCascadeToParts(ObjectLevelModifyQuery query)
Return whether any process leading to object modification should also affect its parts. |
boolean |
verifyDelete(java.lang.Object object,
org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Used to verify whether the specified object is deleted or not. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected transient java.util.Vector<org.eclipse.persistence.internal.helper.DatabaseField> targetForeignKeyFields
protected transient java.util.Vector<org.eclipse.persistence.internal.helper.DatabaseField> sourceKeyFields
protected transient java.util.Map<org.eclipse.persistence.internal.helper.DatabaseField,org.eclipse.persistence.internal.helper.DatabaseField> targetForeignKeysToSourceKeys
protected transient java.util.Map<org.eclipse.persistence.internal.helper.DatabaseField,org.eclipse.persistence.internal.helper.DatabaseField> sourceKeysToTargetForeignKeys
Constructor Detail |
---|
public OneToManyMapping()
Method Detail |
---|
public boolean isRelationalMapping()
isRelationalMapping
in class DatabaseMapping
public void addTargetForeignKeyField(org.eclipse.persistence.internal.helper.DatabaseField targetForeignKeyField, org.eclipse.persistence.internal.helper.DatabaseField sourceKeyField)
public void addTargetForeignKeyFieldName(java.lang.String targetForeignKeyFieldName, java.lang.String sourceKeyFieldName)
DirectToFieldMapping
,
ManyToManyMapping
,
AggregateCollectionMapping
protected Expression buildDefaultSelectionCriteria()
public Expression buildSelectionCriteria()
public java.lang.Object clone()
clone
in class CollectionMapping
protected void deleteAll(DeleteObjectQuery query) throws DatabaseException
DatabaseException
protected void deleteReferenceObjectsLeftOnDatabase(DeleteObjectQuery query) throws DatabaseException, OptimisticLockException
DatabaseException
OptimisticLockException
protected java.util.Hashtable executeBatchQuery(DatabaseQuery query, org.eclipse.persistence.internal.sessions.AbstractSession session, org.eclipse.persistence.internal.sessions.AbstractRecord row)
protected java.util.Vector extractForeignKeyFromReferenceObject(java.lang.Object object, org.eclipse.persistence.internal.sessions.AbstractSession session)
protected java.util.Vector extractKeyFromRow(org.eclipse.persistence.internal.sessions.AbstractRecord row, org.eclipse.persistence.internal.sessions.AbstractSession session)
public java.lang.Object extractResultFromBatchQuery(DatabaseQuery query, org.eclipse.persistence.internal.sessions.AbstractRecord row, org.eclipse.persistence.internal.sessions.AbstractSession session, org.eclipse.persistence.internal.sessions.AbstractRecord argumentRow)
extractResultFromBatchQuery
in class ForeignReferenceMapping
public java.util.Vector getSourceKeyFieldNames()
public java.util.Vector<org.eclipse.persistence.internal.helper.DatabaseField> getSourceKeyFields()
public java.util.Map<org.eclipse.persistence.internal.helper.DatabaseField,org.eclipse.persistence.internal.helper.DatabaseField> getSourceKeysToTargetForeignKeys()
public java.util.Vector getTargetForeignKeyFieldNames()
public java.util.Vector<org.eclipse.persistence.internal.helper.DatabaseField> getTargetForeignKeyFields()
public java.util.Map<org.eclipse.persistence.internal.helper.DatabaseField,org.eclipse.persistence.internal.helper.DatabaseField> getTargetForeignKeysToSourceKeys()
public java.util.Map getTargetForeignKeyToSourceKeys()
public boolean hasInverseConstraintDependency()
hasInverseConstraintDependency
in class DatabaseMapping
public void initialize(org.eclipse.persistence.internal.sessions.AbstractSession session) throws DescriptorException
initialize
in class CollectionMapping
DescriptorException
protected void initializeDeleteAllQuery()
protected void initializeTargetForeignKeysToSourceKeys() throws DescriptorException
DescriptorException
public boolean isOneToManyMapping()
isOneToManyMapping
in class DatabaseMapping
protected boolean isSourceKeySpecified()
public void postInsert(WriteObjectQuery query) throws DatabaseException, OptimisticLockException
postInsert
in class DatabaseMapping
DatabaseException
OptimisticLockException
public void postUpdate(WriteObjectQuery query) throws DatabaseException, OptimisticLockException
postUpdate
in class DatabaseMapping
DatabaseException
OptimisticLockException
public void preDelete(DeleteObjectQuery query) throws DatabaseException, OptimisticLockException
preDelete
in class DatabaseMapping
DatabaseException
OptimisticLockException
public void prepareCascadeLockingPolicy()
prepareCascadeLockingPolicy
in class DatabaseMapping
public void setDeleteAllSQLString(java.lang.String sqlString)
Example: "delete from PHONE where OWNER_ID = #EMPLOYEE_ID"
setDeleteAllSQLString
in class CollectionMapping
public void setSourceKeyFieldNames(java.util.Vector fieldNames)
public void setSourceKeyFields(java.util.Vector<org.eclipse.persistence.internal.helper.DatabaseField> sourceKeyFields)
public void setTargetForeignKeyFieldName(java.lang.String targetForeignKeyFieldName)
DirectToFieldMapping
,
ManyToManyMapping
,
AggregateCollectionMapping
public void setTargetForeignKeyFieldNames(java.lang.String[] targetForeignKeyFieldNames, java.lang.String[] sourceKeyFieldNames)
public void setTargetForeignKeyFieldNames(java.util.Vector fieldNames)
public void setTargetForeignKeyFields(java.util.Vector<org.eclipse.persistence.internal.helper.DatabaseField> targetForeignKeyFields)
protected void setTargetForeignKeysToSourceKeys(java.util.Map<org.eclipse.persistence.internal.helper.DatabaseField,org.eclipse.persistence.internal.helper.DatabaseField> targetForeignKeysToSourceKeys)
protected boolean shouldObjectModifyCascadeToParts(ObjectLevelModifyQuery query)
shouldObjectModifyCascadeToParts
in class ForeignReferenceMapping
public boolean isCascadedLockingSupported()
isCascadedLockingSupported
in class DatabaseMapping
public boolean isJoiningSupported()
isJoiningSupported
in class ForeignReferenceMapping
public boolean verifyDelete(java.lang.Object object, org.eclipse.persistence.internal.sessions.AbstractSession session) throws DatabaseException
verifyDelete
in class CollectionMapping
DatabaseException
|
EclipseLink 1.1.1_ 1.1.1.v20090430-r4097 API Reference | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |