|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.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.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class org.eclipse.persistence.mappings.DatabaseMapping |
|---|
DatabaseMapping.WriteType |
| Field Summary |
|---|
| Fields inherited from class org.eclipse.persistence.mappings.ForeignReferenceMapping |
|---|
INNER_JOIN, NONE, OUTER_JOIN, QUERY_BATCH_PARAMETER |
| 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(String targetForeignKeyFieldName,
String sourceKeyFieldName)
PUBLIC: Define the target foreign key relationship in the one-to-many mapping. |
Expression |
buildSelectionCriteria()
This method would allow customers to get the potential selection criteria for a mapping prior to initialization. |
Object |
clone()
INTERNAL: Clone the appropriate attributes. |
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. |
Vector |
getSourceKeyFieldNames()
PUBLIC: Return the source key field names associated with the mapping. |
Vector<org.eclipse.persistence.internal.helper.DatabaseField> |
getSourceKeyFields()
INTERNAL: Return the source key fields. |
Map<org.eclipse.persistence.internal.helper.DatabaseField,org.eclipse.persistence.internal.helper.DatabaseField> |
getSourceKeysToTargetForeignKeys()
INTERNAL: Return the source/target key fields. |
Vector |
getTargetForeignKeyFieldNames()
INTERNAL: Return the target foreign key field names associated with the mapping. |
Vector<org.eclipse.persistence.internal.helper.DatabaseField> |
getTargetForeignKeyFields()
INTERNAL: Return the target foreign key fields. |
Map<org.eclipse.persistence.internal.helper.DatabaseField,org.eclipse.persistence.internal.helper.DatabaseField> |
getTargetForeignKeysToSourceKeys()
INTERNAL: Return the target/source key fields. |
Map |
getTargetForeignKeyToSourceKeys()
INTERNAL: Maintain for backward compatibility. |
List<org.eclipse.persistence.internal.helper.DatabaseField> |
getTargetPrimaryKeyFields()
INTERNAL: Primary keys of targetForeignKeyTable. |
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. |
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: |
void |
performDataModificationEvent(Object[] event,
org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Perform the commit event. |
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. |
boolean |
requiresDataModificationEvents()
INTERNAL: Returns whether this mapping uses data modification events to complete its writes |
void |
setAddTargetSQLString(String sqlString)
PUBLIC: |
void |
setCustomAddTargetQuery(DataModifyQuery query)
PUBLIC: The default add target query for mapping can be overridden by specifying the new query. |
void |
setCustomRemoveAllTargetsQuery(DataModifyQuery query)
PUBLIC: The default remove all targets query for mapping can be overridden by specifying the new query. |
void |
setCustomRemoveTargetQuery(DataModifyQuery query)
PUBLIC: The default remove target query for mapping can be overridden by specifying the new query. |
void |
setDeleteAllSQLString(String sqlString)
PUBLIC: Set the SQL string used by the mapping to delete the target objects. |
void |
setSessionName(String name)
PUBLIC: Set the name of the session to execute the mapping's queries under. |
void |
setSourceKeyFieldNames(Vector fieldNames)
INTERNAL: Set the source key field names associated with the mapping. |
void |
setSourceKeyFields(Vector<org.eclipse.persistence.internal.helper.DatabaseField> sourceKeyFields)
INTERNAL: Set the source key fields. |
void |
setTargetForeignKeyFieldName(String targetForeignKeyFieldName)
PUBLIC: Define the target foreign key relationship in the one-to-many mapping. |
void |
setTargetForeignKeyFieldNames(String[] targetForeignKeyFieldNames,
String[] sourceKeyFieldNames)
PUBLIC: Define the target foreign key relationship in the one-to-many mapping. |
void |
setTargetForeignKeyFieldNames(Vector fieldNames)
INTERNAL: Set the target key field names associated with the mapping. |
void |
setTargetForeignKeyFields(Vector<org.eclipse.persistence.internal.helper.DatabaseField> targetForeignKeyFields)
INTERNAL: Set the target fields. |
void |
updateTargetForeignKeyPostUpdateSource_ObjectAdded(ObjectLevelModifyQuery query,
Object objectAdded,
Map extraData)
INTERNAL: Update target foreign key after a target object was added to the source. |
void |
updateTargetForeignKeyPostUpdateSource_ObjectRemoved(ObjectLevelModifyQuery query,
Object objectRemoved)
INTERNAL: Update target foreign key after a target object was removed from the source. |
void |
updateTargetRowPostInsertSource(WriteObjectQuery query)
INTERNAL: Update target foreign keys after a new source was inserted. |
void |
updateTargetRowPreDeleteSource(ObjectLevelModifyQuery query)
INTERNAL: Update target foreign key after a target object was removed from the source. |
boolean |
verifyDelete(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, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| 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(String targetForeignKeyFieldName,
String sourceKeyFieldName)
DirectToFieldMapping,
ManyToManyMapping,
AggregateCollectionMappingpublic Expression buildSelectionCriteria()
public Object clone()
clone in class CollectionMapping
public Object createMapComponentFromRow(org.eclipse.persistence.internal.sessions.AbstractRecord dbRow,
ObjectBuildingQuery query,
org.eclipse.persistence.internal.sessions.AbstractSession session)
createMapComponentFromRow in interface MapComponentMappingpublic Vector getSourceKeyFieldNames()
public Vector<org.eclipse.persistence.internal.helper.DatabaseField> getSourceKeyFields()
public Map<org.eclipse.persistence.internal.helper.DatabaseField,org.eclipse.persistence.internal.helper.DatabaseField> getSourceKeysToTargetForeignKeys()
public List<org.eclipse.persistence.internal.helper.DatabaseField> getTargetPrimaryKeyFields()
getTargetPrimaryKeyFields in class CollectionMappingpublic Vector getTargetForeignKeyFieldNames()
public Vector<org.eclipse.persistence.internal.helper.DatabaseField> getTargetForeignKeyFields()
public Map<org.eclipse.persistence.internal.helper.DatabaseField,org.eclipse.persistence.internal.helper.DatabaseField> getTargetForeignKeysToSourceKeys()
public Map getTargetForeignKeyToSourceKeys()
public boolean hasInverseConstraintDependency()
hasInverseConstraintDependency in class DatabaseMapping
public void initialize(org.eclipse.persistence.internal.sessions.AbstractSession session)
throws DescriptorException
initialize in class CollectionMappingDescriptorExceptionpublic boolean isOneToManyMapping()
isOneToManyMapping in class DatabaseMapping
public void performDataModificationEvent(Object[] event,
org.eclipse.persistence.internal.sessions.AbstractSession session)
throws DatabaseException,
DescriptorException
performDataModificationEvent in class DatabaseMappingDatabaseException
DescriptorException
public void postInsert(WriteObjectQuery query)
throws DatabaseException,
OptimisticLockException
postInsert in class CollectionMappingDatabaseException
OptimisticLockException
public void postUpdate(WriteObjectQuery query)
throws DatabaseException,
OptimisticLockException
postUpdate in class DatabaseMappingDatabaseException
OptimisticLockException
public void preDelete(DeleteObjectQuery query)
throws DatabaseException,
OptimisticLockException
preDelete in class DatabaseMappingDatabaseException
OptimisticLockExceptionpublic void prepareCascadeLockingPolicy()
prepareCascadeLockingPolicy in class DatabaseMappingpublic boolean requiresDataModificationEvents()
UnidirectionalOneToManyMappingpublic void setCustomAddTargetQuery(DataModifyQuery query)
public void setAddTargetSQLString(String sqlString)
public void setCustomRemoveTargetQuery(DataModifyQuery query)
public void setCustomRemoveAllTargetsQuery(DataModifyQuery query)
public void setDeleteAllSQLString(String sqlString)
Example: "delete from PHONE where OWNER_ID = #EMPLOYEE_ID"
setDeleteAllSQLString in class CollectionMappingpublic void setSessionName(String name)
setSessionName in class CollectionMappingpublic void setSourceKeyFieldNames(Vector fieldNames)
public void setSourceKeyFields(Vector<org.eclipse.persistence.internal.helper.DatabaseField> sourceKeyFields)
public void setTargetForeignKeyFieldName(String targetForeignKeyFieldName)
DirectToFieldMapping,
ManyToManyMapping,
AggregateCollectionMapping
public void setTargetForeignKeyFieldNames(String[] targetForeignKeyFieldNames,
String[] sourceKeyFieldNames)
public void setTargetForeignKeyFieldNames(Vector fieldNames)
public void setTargetForeignKeyFields(Vector<org.eclipse.persistence.internal.helper.DatabaseField> targetForeignKeyFields)
public boolean isCascadedLockingSupported()
isCascadedLockingSupported in class DatabaseMappingpublic boolean isJoiningSupported()
isJoiningSupported in class ForeignReferenceMapping
public void updateTargetRowPostInsertSource(WriteObjectQuery query)
throws DatabaseException
DatabaseException
public void updateTargetForeignKeyPostUpdateSource_ObjectAdded(ObjectLevelModifyQuery query,
Object objectAdded,
Map extraData)
throws DatabaseException
- Extract primary key and its value from the source object.
- Extract target key and its value from the target object.
- Construct an update statement with above fields and values for target table.
- execute the statement.
DatabaseException
public void updateTargetForeignKeyPostUpdateSource_ObjectRemoved(ObjectLevelModifyQuery query,
Object objectRemoved)
throws DatabaseException
- Extract primary key and its value from the source object.
- Extract target key and its value from the target object.
- Construct an update statement with above fields and values for target table.
- execute the statement.
DatabaseException
public void updateTargetRowPreDeleteSource(ObjectLevelModifyQuery query)
throws DatabaseException
- Extract primary key and its value from the source object.
- Extract target key and its value from the target object.
- Construct an update statement with above fields and values for target table.
- execute the statement.
DatabaseException
public boolean verifyDelete(Object object,
org.eclipse.persistence.internal.sessions.AbstractSession session)
throws DatabaseException
verifyDelete in class CollectionMappingDatabaseException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||