FileDocCategorySizeDatePackage
MappingReferenceKeyElement.javaAPI DocGlassfish v2 API6271Fri May 04 22:34:44 BST 2007com.sun.jdo.api.persistence.model.mapping

MappingReferenceKeyElement

public interface MappingReferenceKeyElement implements MappingMemberElement, ReferenceKey
This is an element which represents a relationship between two tables (primary and secondary). It should not be used for relationship fields (MappingRelationshipElement has its own set of pairs). It can be thought of as a "fake foreign key" meaning it designates the column pairs used to join the primary table with a secondary table. It is analagous to a foreign key and may in fact contain identical pairs as the foreign key, but this is not a requirement. The foreign key may define a different set of pairs or may not exist at all. Although any set of pairs is legal, the user should be careful to define pairs which represent a logical relationship between the two tables. The relationship should be set up as follows: First, set a primary table for the mapping class. Doing this sets up a "fake primary key" for the associated mapping table element. Next, add a secondary table and set up the pairs which establish the connection on the returned reference key object. This sets up whatever "fake primary key" information is necessary on the secondary table's mapping table, establishes the primary to secondary relationship via the reference keys, and puts the pair information into the "fake foreign key".
author
Mark Munro
author
Rochelle Raccah
version
%I%

Fields Summary
Constructors Summary
Methods Summary
public voidaddColumnPair(ColumnPairElement pair)
Add a new column pair to the holder.

param
pair the pair to add
throws
ModelException if impossible

public voidaddColumnPairs(ColumnPairElement[] pairs)
Add some new column pairs to the holder.

param
pairs the column pairs to add
throws
ModelException if impossible

public java.util.ArrayListgetColumnPairNames()
Returns the list of relative column pair names in this referencing key.

return
the names of the column pairs in this referencing key

public MappingTableElementgetTable()
Returns the mapping table element for this referencing key.

return
the meta data table for this referencing key

public voidremoveColumnPair(java.lang.String pairName)
Remove a column pair from the holder. This method can be used to remove a pair by name when it cannot be resolved to an actual pair.

param
pairName the relative name of the column pair to remove
throws
ModelException if impossible

public voidremoveColumnPair(ColumnPairElement pair)
Remove a column pair from the holder.

param
pair the column pair to remove
throws
ModelException if impossible

public voidremoveColumnPairs(java.util.ArrayList pairNames)
Remove some column pairs from the holder. This method can be used to remove pairs by name when they cannot be resolved to actual pairs.

param
pairNames the relative names of the column pairs to remove
throws
ModelException if impossible

public voidremoveColumnPairs(ColumnPairElement[] pairs)
Remove some column pairs from the holder.

param
pairs the column pairs to remove
throws
ModelException if impossible

public voidsetColumnPairs(ColumnPairElement[] pairs)
Set the column pairs for this holder. Previous column pairs are removed.

param
pairs the new column pairs
throws
ModelException if impossible

public voidsetTable(MappingTableElement table)
Set the mapping table for this referencing key to the supplied table.

param
table mapping table element to be used with this key.
exception
ModelException if impossible