Interface MappingReferenceKeyElement
-
- All Superinterfaces:
org.netbeans.modules.dbschema.ColumnPairElementHolder
,Comparable
,MappingElement
,MappingElementProperties
,MappingMemberElement
,org.netbeans.modules.dbschema.ReferenceKey
- All Known Implementing Classes:
MappingReferenceKeyElementImpl
public interface MappingReferenceKeyElement extends MappingMemberElement, org.netbeans.modules.dbschema.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".- Version:
- %I%
- Author:
- Mark Munro, Rochelle Raccah
-
-
Field Summary
-
Fields inherited from interface com.sun.jdo.api.persistence.model.mapping.MappingElementProperties
PROP_ASSOCIATED_COLUMNS, PROP_COLUMNS, PROP_CONSISTENCY, PROP_DATABASE_ROOT, PROP_FETCH_GROUP, PROP_FIELDS, PROP_IN_CONCURRENCY_CHECK, PROP_KEY_COLUMNS, PROP_MODIFIED, PROP_NAME, PROP_NAVIGABLE, PROP_READ_ONLY, PROP_REFERENCING_KEYS, PROP_TABLE, PROP_TABLES, PROP_VERSION_FIELD
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addColumnPair(org.netbeans.modules.dbschema.ColumnPairElement pair)
Add a new column pair to the holder.void
addColumnPairs(org.netbeans.modules.dbschema.ColumnPairElement[] pairs)
Add some new column pairs to the holder.ArrayList
getColumnPairNames()
Returns the list of relative column pair names in this referencing key.MappingTableElement
getTable()
Returns the mapping table element for this referencing key.void
removeColumnPair(String pairName)
Remove a column pair from the holder.void
removeColumnPair(org.netbeans.modules.dbschema.ColumnPairElement pair)
Remove a column pair from the holder.void
removeColumnPairs(ArrayList pairNames)
Remove some column pairs from the holder.void
removeColumnPairs(org.netbeans.modules.dbschema.ColumnPairElement[] pairs)
Remove some column pairs from the holder.void
setColumnPairs(org.netbeans.modules.dbschema.ColumnPairElement[] pairs)
Set the column pairs for this holder.void
setTable(MappingTableElement table)
Set the mapping table for this referencing key to the supplied table.-
Methods inherited from interface org.netbeans.modules.dbschema.ColumnPairElementHolder
getColumnPair, getColumnPairs
-
Methods inherited from interface java.lang.Comparable
compareTo
-
Methods inherited from interface com.sun.jdo.api.persistence.model.mapping.MappingElement
addPropertyChangeListener, addVetoableChangeListener, getName, removePropertyChangeListener, removeVetoableChangeListener, setName
-
Methods inherited from interface com.sun.jdo.api.persistence.model.mapping.MappingMemberElement
getDeclaringClass
-
-
-
-
Method Detail
-
getTable
MappingTableElement getTable()
Returns the mapping table element for this referencing key.- Returns:
- the meta data table for this referencing key
-
setTable
void setTable(MappingTableElement table) throws ModelException
Set the mapping table for this referencing key to the supplied table.- Parameters:
table
- mapping table element to be used with this key.- Throws:
ModelException
- if impossible
-
getColumnPairNames
ArrayList getColumnPairNames()
Returns the list of relative column pair names in this referencing key.- Returns:
- the names of the column pairs in this referencing key
-
removeColumnPair
void removeColumnPair(String pairName) throws ModelException
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.- Parameters:
pairName
- the relative name of the column pair to remove- Throws:
ModelException
- if impossible
-
removeColumnPairs
void removeColumnPairs(ArrayList pairNames) throws ModelException
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.- Parameters:
pairNames
- the relative names of the column pairs to remove- Throws:
ModelException
- if impossible
-
addColumnPair
void addColumnPair(org.netbeans.modules.dbschema.ColumnPairElement pair) throws ModelException
Add a new column pair to the holder.- Specified by:
addColumnPair
in interfaceorg.netbeans.modules.dbschema.ColumnPairElementHolder
- Parameters:
pair
- the pair to add- Throws:
ModelException
- if impossible
-
addColumnPairs
void addColumnPairs(org.netbeans.modules.dbschema.ColumnPairElement[] pairs) throws ModelException
Add some new column pairs to the holder.- Specified by:
addColumnPairs
in interfaceorg.netbeans.modules.dbschema.ColumnPairElementHolder
- Parameters:
pairs
- the column pairs to add- Throws:
ModelException
- if impossible
-
removeColumnPair
void removeColumnPair(org.netbeans.modules.dbschema.ColumnPairElement pair) throws ModelException
Remove a column pair from the holder.- Specified by:
removeColumnPair
in interfaceorg.netbeans.modules.dbschema.ColumnPairElementHolder
- Parameters:
pair
- the column pair to remove- Throws:
ModelException
- if impossible
-
removeColumnPairs
void removeColumnPairs(org.netbeans.modules.dbschema.ColumnPairElement[] pairs) throws ModelException
Remove some column pairs from the holder.- Specified by:
removeColumnPairs
in interfaceorg.netbeans.modules.dbschema.ColumnPairElementHolder
- Parameters:
pairs
- the column pairs to remove- Throws:
ModelException
- if impossible
-
setColumnPairs
void setColumnPairs(org.netbeans.modules.dbschema.ColumnPairElement[] pairs) throws ModelException
Set the column pairs for this holder. Previous column pairs are removed.- Specified by:
setColumnPairs
in interfaceorg.netbeans.modules.dbschema.ColumnPairElementHolder
- Parameters:
pairs
- the new column pairs- Throws:
ModelException
- if impossible
-
-